Codebase list flex / 08e1b25
scanner: use calloc to allocate new filter memory Michael W. Bombardieri authored 6 years ago Will Estes committed 6 years ago
1 changed file(s) with 4 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
4646 va_list ap;
4747
4848 /* allocate and initialize new filter */
49 f = malloc(sizeof(struct filter));
49 f = calloc(sizeof(struct filter), 1);
5050 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"));
5352 f->filter_func = NULL;
5453 f->extra = NULL;
5554 f->next = NULL;
9998 struct filter *f;
10099
101100 /* allocate and initialize new filter */
102 f = malloc(sizeof(struct filter));
101 f = calloc(sizeof(struct filter), 1);
103102 if (!f)
104 flexerror(_("malloc failed in filter_create_int"));
105 memset (f, 0, sizeof (*f));
103 flexerror(_("calloc failed in filter_create_int"));
106104 f->next = NULL;
107105 f->argc = 0;
108106 f->argv = NULL;