scanner: use calloc to allocate new filter memory
Michael W. Bombardieri authored 6 years ago
Will Estes committed 6 years ago
46 | 46 | va_list ap; |
47 | 47 | |
48 | 48 | /* allocate and initialize new filter */ |
49 | f = malloc(sizeof(struct filter)); | |
49 | f = calloc(sizeof(struct filter), 1); | |
50 | 50 | if (!f) |
51 | flexerror(_("malloc failed (f) in filter_create_ext")); | |
52 | memset (f, 0, sizeof (*f)); | |
51 | flexerror(_("calloc failed (f) in filter_create_ext")); | |
53 | 52 | f->filter_func = NULL; |
54 | 53 | f->extra = NULL; |
55 | 54 | f->next = NULL; |
99 | 98 | struct filter *f; |
100 | 99 | |
101 | 100 | /* allocate and initialize new filter */ |
102 | f = malloc(sizeof(struct filter)); | |
101 | f = calloc(sizeof(struct filter), 1); | |
103 | 102 | if (!f) |
104 | flexerror(_("malloc failed in filter_create_int")); | |
105 | memset (f, 0, sizeof (*f)); | |
103 | flexerror(_("calloc failed in filter_create_int")); | |
106 | 104 | f->next = NULL; |
107 | 105 | f->argc = 0; |
108 | 106 | f->argv = NULL; |