• Masahiro Yamada's avatar
    kconfig: fix memory leak when EOF is encountered in quotation · 507a004e
    Masahiro Yamada authored
    [ Upstream commit fbac5977 ]
    
    An unterminated string literal followed by new line is passed to the
    parser (with "multi-line strings not supported" warning shown), then
    handled properly there.
    
    On the other hand, an unterminated string literal at end of file is
    never passed to the parser, then results in memory leak.
    
    [Test Code]
    
      ----------(Kconfig begin)----------
      source "Kconfig.inc"
    
      config A
              bool "a"
      -----------(Kconfig end)-----------
    
      --------(Kconfig.inc begin)--------
      config B
              bool "b\No new line at end of file
      ---------(Kconfig.inc end)---------
    
    [Summary from Valgrind]
    
      Before the fix:
    
        LEAK SUMMARY:
           definitely lost: 16 bytes in 1 blocks
           ...
    
      After the fix:
    
        LEAK SUMMARY:
           definitely lost: 0 bytes in 0 blocks
           ...
    
    Eliminate the memory leak path by handling this case. Of course, such
    a Kconfig file is wrong already, so I will add an error message later.
    Signed-off-by: 's avatarMasahiro Yamada <yamada.masahiro@socionext.com>
    Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
    507a004e
Name
Last commit
Last update
..
lxdialog Loading commit data...
tests Loading commit data...
.gitignore Loading commit data...
Makefile Loading commit data...
conf.c Loading commit data...
confdata.c Loading commit data...
expr.c Loading commit data...
expr.h Loading commit data...
gconf-cfg.sh Loading commit data...
gconf.c Loading commit data...
gconf.glade Loading commit data...
images.c Loading commit data...
kconf_id.c Loading commit data...
list.h Loading commit data...
lkc.h Loading commit data...
lkc_proto.h Loading commit data...
mconf-cfg.sh Loading commit data...
mconf.c Loading commit data...
menu.c Loading commit data...
merge_config.sh Loading commit data...
nconf-cfg.sh Loading commit data...
nconf.c Loading commit data...
nconf.gui.c Loading commit data...
nconf.h Loading commit data...
preprocess.c Loading commit data...
qconf-cfg.sh Loading commit data...
qconf.cc Loading commit data...
qconf.h Loading commit data...
streamline_config.pl Loading commit data...
symbol.c Loading commit data...
util.c Loading commit data...
zconf.l Loading commit data...
zconf.y Loading commit data...