kconfig: remove 'const' from the return type of sym_escape_string_value()

sym_escape_string_value() returns a malloc'ed memory, but as
(const char *). So, it must be casted to (void *) when it is free'd.
This is odd.

The return type of sym_escape_string_value() should be (char *).

I exploited that free(NULL) has no effect.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
Masahiro Yamada
2021-10-01 14:32:44 +09:00
parent 6988f70cf1
commit 229d0cfae5
4 changed files with 24 additions and 23 deletions

View File

@@ -647,17 +647,16 @@ static void check_conf(struct menu *menu)
switch (input_mode) {
case listnewconfig:
if (sym->name) {
const char *str;
const char *val = sym_get_string_value(sym);
char *escaped = NULL;
if (sym->type == S_STRING) {
str = sym_get_string_value(sym);
str = sym_escape_string_value(str);
printf("%s%s=%s\n", CONFIG_, sym->name, str);
free((void *)str);
} else {
str = sym_get_string_value(sym);
printf("%s%s=%s\n", CONFIG_, sym->name, str);
escaped = sym_escape_string_value(val);
val = escaped;
}
printf("%s%s=%s\n", CONFIG_, sym->name, val);
free(escaped);
}
break;
case helpnewconfig: