Commit 8494453a authored by Arnaud Lacombe's avatar Arnaud Lacombe

kconfig: use calloc() for expr allocation

Signed-off-by: default avatarArnaud Lacombe <lacombar@gmail.com>
parent 1ea3ad4e
...@@ -13,8 +13,7 @@ ...@@ -13,8 +13,7 @@
struct expr *expr_alloc_symbol(struct symbol *sym) struct expr *expr_alloc_symbol(struct symbol *sym)
{ {
struct expr *e = malloc(sizeof(*e)); struct expr *e = calloc(1, sizeof(*e));
memset(e, 0, sizeof(*e));
e->type = E_SYMBOL; e->type = E_SYMBOL;
e->left.sym = sym; e->left.sym = sym;
return e; return e;
...@@ -22,8 +21,7 @@ struct expr *expr_alloc_symbol(struct symbol *sym) ...@@ -22,8 +21,7 @@ struct expr *expr_alloc_symbol(struct symbol *sym)
struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
{ {
struct expr *e = malloc(sizeof(*e)); struct expr *e = calloc(1, sizeof(*e));
memset(e, 0, sizeof(*e));
e->type = type; e->type = type;
e->left.expr = ce; e->left.expr = ce;
return e; return e;
...@@ -31,8 +29,7 @@ struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) ...@@ -31,8 +29,7 @@ struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2) struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2)
{ {
struct expr *e = malloc(sizeof(*e)); struct expr *e = calloc(1, sizeof(*e));
memset(e, 0, sizeof(*e));
e->type = type; e->type = type;
e->left.expr = e1; e->left.expr = e1;
e->right.expr = e2; e->right.expr = e2;
...@@ -41,8 +38,7 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e ...@@ -41,8 +38,7 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e
struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2) struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2)
{ {
struct expr *e = malloc(sizeof(*e)); struct expr *e = calloc(1, sizeof(*e));
memset(e, 0, sizeof(*e));
e->type = type; e->type = type;
e->left.sym = s1; e->left.sym = s1;
e->right.sym = s2; e->right.sym = s2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment