aboutsummaryrefslogtreecommitdiff
path: root/scripts/parse_kconfig/boolexpr.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/parse_kconfig/boolexpr.c')
-rw-r--r--scripts/parse_kconfig/boolexpr.c23
1 files changed, 13 insertions, 10 deletions
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;
}