aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/kconfig/expr.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index 792c62ed9d63..290ce41f8ba4 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -13,8 +13,7 @@
13 13
14struct expr *expr_alloc_symbol(struct symbol *sym) 14struct expr *expr_alloc_symbol(struct symbol *sym)
15{ 15{
16 struct expr *e = malloc(sizeof(*e)); 16 struct expr *e = calloc(1, sizeof(*e));
17 memset(e, 0, sizeof(*e));
18 e->type = E_SYMBOL; 17 e->type = E_SYMBOL;
19 e->left.sym = sym; 18 e->left.sym = sym;
20 return e; 19 return e;
@@ -22,8 +21,7 @@ struct expr *expr_alloc_symbol(struct symbol *sym)
22 21
23struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) 22struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
24{ 23{
25 struct expr *e = malloc(sizeof(*e)); 24 struct expr *e = calloc(1, sizeof(*e));
26 memset(e, 0, sizeof(*e));
27 e->type = type; 25 e->type = type;
28 e->left.expr = ce; 26 e->left.expr = ce;
29 return e; 27 return e;
@@ -31,8 +29,7 @@ struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
31 29
32struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2) 30struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2)
33{ 31{
34 struct expr *e = malloc(sizeof(*e)); 32 struct expr *e = calloc(1, sizeof(*e));
35 memset(e, 0, sizeof(*e));
36 e->type = type; 33 e->type = type;
37 e->left.expr = e1; 34 e->left.expr = e1;
38 e->right.expr = e2; 35 e->right.expr = e2;
@@ -41,8 +38,7 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e
41 38
42struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2) 39struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2)
43{ 40{
44 struct expr *e = malloc(sizeof(*e)); 41 struct expr *e = calloc(1, sizeof(*e));
45 memset(e, 0, sizeof(*e));
46 e->type = type; 42 e->type = type;
47 e->left.sym = s1; 43 e->left.sym = s1;
48 e->right.sym = s2; 44 e->right.sym = s2;