mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user