diff options
author | Ulf Magnusson <ulfalizer@gmail.com> | 2017-10-08 13:35:45 -0400 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-01-21 10:49:27 -0500 |
commit | 5b1374b3b3c2fc4f63a398adfa446fb8eff791a4 (patch) | |
tree | faa80c9d672447f3ae14c4d2d15ce82281df96c0 /scripts/kconfig/expr.c | |
parent | ae7440ef0c8013d68c00dad6900e7cce5311bb1c (diff) |
kconfig: Fix expr_free() E_NOT leak
Only the E_NOT operand and not the E_NOT node itself was freed, due to
accidentally returning too early in expr_free(). Outline of leak:
switch (e->type) {
...
case E_NOT:
expr_free(e->left.expr);
return;
...
}
*Never reached, 'e' leaked*
free(e);
Fix by changing the 'return' to a 'break'.
Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix:
LEAK SUMMARY:
definitely lost: 44,448 bytes in 1,852 blocks
...
Summary after the fix:
LEAK SUMMARY:
definitely lost: 1,608 bytes in 67 blocks
...
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts/kconfig/expr.c')
-rw-r--r-- | scripts/kconfig/expr.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index cbf4996dd9c1..ed29bad1f03a 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c | |||
@@ -113,7 +113,7 @@ void expr_free(struct expr *e) | |||
113 | break; | 113 | break; |
114 | case E_NOT: | 114 | case E_NOT: |
115 | expr_free(e->left.expr); | 115 | expr_free(e->left.expr); |
116 | return; | 116 | break; |
117 | case E_EQUAL: | 117 | case E_EQUAL: |
118 | case E_GEQ: | 118 | case E_GEQ: |
119 | case E_GTH: | 119 | case E_GTH: |