aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/expr.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig/expr.c')
-rw-r--r--scripts/kconfig/expr.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index 001003452f6..290ce41f8ba 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -7,15 +7,13 @@
7#include <stdlib.h> 7#include <stdlib.h>
8#include <string.h> 8#include <string.h>
9 9
10#define LKC_DIRECT_LINK
11#include "lkc.h" 10#include "lkc.h"
12 11
13#define DEBUG_EXPR 0 12#define DEBUG_EXPR 0
14 13
15struct expr *expr_alloc_symbol(struct symbol *sym) 14struct expr *expr_alloc_symbol(struct symbol *sym)
16{ 15{
17 struct expr *e = malloc(sizeof(*e)); 16 struct expr *e = calloc(1, sizeof(*e));
18 memset(e, 0, sizeof(*e));
19 e->type = E_SYMBOL; 17 e->type = E_SYMBOL;
20 e->left.sym = sym; 18 e->left.sym = sym;
21 return e; 19 return e;
@@ -23,8 +21,7 @@ struct expr *expr_alloc_symbol(struct symbol *sym)
23 21
24struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) 22struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
25{ 23{
26 struct expr *e = malloc(sizeof(*e)); 24 struct expr *e = calloc(1, sizeof(*e));
27 memset(e, 0, sizeof(*e));
28 e->type = type; 25 e->type = type;
29 e->left.expr = ce; 26 e->left.expr = ce;
30 return e; 27 return e;
@@ -32,8 +29,7 @@ struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
32 29
33struct 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)
34{ 31{
35 struct expr *e = malloc(sizeof(*e)); 32 struct expr *e = calloc(1, sizeof(*e));
36 memset(e, 0, sizeof(*e));
37 e->type = type; 33 e->type = type;
38 e->left.expr = e1; 34 e->left.expr = e1;
39 e->right.expr = e2; 35 e->right.expr = e2;
@@ -42,8 +38,7 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e
42 38
43struct 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)
44{ 40{
45 struct expr *e = malloc(sizeof(*e)); 41 struct expr *e = calloc(1, sizeof(*e));
46 memset(e, 0, sizeof(*e));
47 e->type = type; 42 e->type = type;
48 e->left.sym = s1; 43 e->left.sym = s1;
49 e->right.sym = s2; 44 e->right.sym = s2;