Commit 407868de authored by Masahiro Yamada's avatar Masahiro Yamada

kconfig: remove redundant NULL pointer check before free()

Passing NULL to free() is allowed and is a no-op.

Remove redundant NULL pointer checks.
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
parent 9ad86d74
...@@ -432,8 +432,7 @@ int conf_read_simple(const char *name, int def) ...@@ -432,8 +432,7 @@ int conf_read_simple(const char *name, int def)
case S_INT: case S_INT:
case S_HEX: case S_HEX:
case S_STRING: case S_STRING:
if (sym->def[def].val) free(sym->def[def].val);
free(sym->def[def].val);
/* fall through */ /* fall through */
default: default:
sym->def[def].val = NULL; sym->def[def].val = NULL;
......
...@@ -42,8 +42,7 @@ struct gstr str_new(void) ...@@ -42,8 +42,7 @@ struct gstr str_new(void)
/* Free storage for growable string */ /* Free storage for growable string */
void str_free(struct gstr *gs) void str_free(struct gstr *gs)
{ {
if (gs->s) free(gs->s);
free(gs->s);
gs->s = NULL; gs->s = NULL;
gs->len = 0; gs->len = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment