diff options
author | 2017-08-17 19:27:48 +0000 | |
---|---|---|
committer | 2017-08-17 19:27:48 +0000 | |
commit | e09db2ce1f6c0e25a9f15d9cfc30e15d9a4a88c5 (patch) | |
tree | 07e1d4fbe8d1f6729d79f20f0ce1cef5cc8f9fbb | |
parent | delete some not used code. from Michael W. Bombardieri (diff) | |
download | wireguard-openbsd-e09db2ce1f6c0e25a9f15d9cfc30e15d9a4a88c5.tar.xz wireguard-openbsd-e09db2ce1f6c0e25a9f15d9cfc30e15d9a4a88c5.zip |
combine malloc/memset into calloc. from Michael W. Bombardieri
-rw-r--r-- | usr.bin/lex/filter.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/usr.bin/lex/filter.c b/usr.bin/lex/filter.c index 3ae77c450cf..558e038d2e6 100644 --- a/usr.bin/lex/filter.c +++ b/usr.bin/lex/filter.c @@ -1,4 +1,4 @@ -/* $OpenBSD: filter.c,v 1.7 2016/12/18 06:11:23 krw Exp $ */ +/* $OpenBSD: filter.c,v 1.8 2017/08/17 19:27:48 tedu Exp $ */ /* filter - postprocessing of flex output through filters */ @@ -50,10 +50,9 @@ 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; @@ -103,10 +102,9 @@ 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; |