diff options
| author | Arnaud Lacombe <lacombar@gmail.com> | 2010-09-19 22:45:00 -0400 |
|---|---|---|
| committer | Arnaud Lacombe <lacombar@gmail.com> | 2011-07-02 01:04:37 -0400 |
| commit | 8494453ad50599b0c9d099a230e423a89222ad08 (patch) | |
| tree | 83dc5e19d0ce4211c5ce8dec61686b33bd3e7646 /scripts | |
| parent | 1ea3ad4e93222faf1d138ceb10291376d2da7cc6 (diff) | |
kconfig: use calloc() for expr allocation
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/kconfig/expr.c | 12 |
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 | ||
| 14 | struct expr *expr_alloc_symbol(struct symbol *sym) | 14 | struct 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 | ||
| 23 | struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) | 22 | struct 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 | ||
| 32 | struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2) | 30 | struct 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 | ||
| 42 | struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2) | 39 | struct 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; |
