From a8694ad53dbaf72232398d33e0a94328041c6a1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Fri, 1 May 2015 22:40:16 +0200 Subject: parse_kconfig fix boolexpr_not --- scripts/parse_kconfig/boolexpr.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'scripts/parse_kconfig') diff --git a/scripts/parse_kconfig/boolexpr.c b/scripts/parse_kconfig/boolexpr.c index d29d238..ccd7cef 100644 --- a/scripts/parse_kconfig/boolexpr.c +++ b/scripts/parse_kconfig/boolexpr.c @@ -212,22 +212,25 @@ struct boolexpr *boolexpr_and(struct boolexpr *e1, struct boolexpr *e2) { } struct boolexpr *boolexpr_not(struct boolexpr *e) { + struct boolexpr *rtn; + rtn = malloc(sizeof(struct boolexpr)); + rtn->overusage = 0; + rtn->id = 0; + switch (e->type) { case BT_FALSE: - e->type = BT_TRUE; - return e; + rtn->type = BT_TRUE; + boolexpr_free(e); + break; case BT_TRUE: - e->type = BT_FALSE; - return e; + rtn->type = BT_FALSE; + boolexpr_free(e); + break; default: + rtn->type = BT_NOT; + rtn->left = e; break; } - struct boolexpr *rtn; - rtn = malloc(sizeof(struct boolexpr)); - rtn->type = BT_NOT; - rtn->overusage = 0; - rtn->id = 0; - rtn->left = e; return rtn; } -- cgit v1.2.3