kconfig: Don't leak 'option' arguments during parsing
[carl9170fw.git] / config / zconf.y
index 27b9b3f119789d176d5f46823de5fa1037195933..d49ed3ae5d3e0889aa74fba98b7a5b8b6f5238c3 100644 (file)
@@ -236,8 +236,10 @@ symbol_option_list:
        | symbol_option_list T_WORD symbol_option_arg
 {
        const struct kconf_id *id = kconf_id_lookup($2, strlen($2));
-       if (id && id->flags & TF_OPTION)
+       if (id && id->flags & TF_OPTION) {
                menu_add_option(id->token, $3);
+               free($3);
+       }
        else
                zconfprint("warning: ignoring unknown option %s", $2);
        free($2);
@@ -393,6 +395,7 @@ source_stmt: T_SOURCE prompt T_EOL
 {
        printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2);
        zconf_nextfile($2);
+       free($2);
 };
 
 /* comment entry */