diff options
author | Michael W. Bombardieri <mb@ii.net> | 2017-11-29 08:11:22 -0500 |
---|---|---|
committer | Will Estes <westes575@gmail.com> | 2017-11-29 08:11:22 -0500 |
commit | 08e1b25b0ec17d4312f838efc6f910b64900b009 (patch) | |
tree | f6b9899f8696f678b1c09d662093f2fdc927627f /src/filter.c | |
parent | 87472f5aa72431cd48755fa8537089e00d67e036 (diff) |
scanner: use calloc to allocate new filter memory
Diffstat (limited to 'src/filter.c')
-rw-r--r-- | src/filter.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/filter.c b/src/filter.c index ccdcdd6..a7e69ec 100644 --- a/src/filter.c +++ b/src/filter.c @@ -47,10 +47,9 @@ struct filter *filter_create_ext (struct filter *chain, const char *cmd, va_list ap; /* allocate and initialize new filter */ - f = malloc(sizeof(struct filter)); + f = calloc(sizeof(struct filter), 1); if (!f) - flexerror(_("malloc failed (f) in filter_create_ext")); - memset (f, 0, sizeof (*f)); + flexerror(_("calloc failed (f) in filter_create_ext")); f->filter_func = NULL; f->extra = NULL; f->next = NULL; @@ -100,10 +99,9 @@ struct filter *filter_create_int (struct filter *chain, struct filter *f; /* allocate and initialize new filter */ - f = malloc(sizeof(struct filter)); + f = calloc(sizeof(struct filter), 1); if (!f) - flexerror(_("malloc failed in filter_create_int")); - memset (f, 0, sizeof (*f)); + flexerror(_("calloc failed in filter_create_int")); f->next = NULL; f->argc = 0; f->argv = NULL; |