1 From d6dce53e08b3a06be16d43e1bf566c6c1988e4a9 Mon Sep 17 00:00:00 2001
2 From: Simon Kelley <simon@thekelleys.org.uk>
3 Date: Mon, 11 Jul 2016 21:34:31 +0100
4 Subject: [PATCH] malloc(); memset() -> calloc() for efficiency.
7 src/util.c | 10 +++-------
8 1 file changed, 3 insertions(+), 7 deletions(-)
10 diff --git a/src/util.c b/src/util.c
11 index 82443c9..211690e 100644
14 @@ -244,13 +244,11 @@ unsigned char *do_rfc1035_name(unsigned char *p, char *sval)
15 /* for use during startup */
16 void *safe_malloc(size_t size)
18 - void *ret = malloc(size);
19 + void *ret = calloc(1, size);
22 die(_("could not get memory"), NULL, EC_NOMEM);
24 - memset(ret, 0, size);
30 @@ -264,12 +262,10 @@ void safe_pipe(int *fd, int read_noblock)
32 void *whine_malloc(size_t size)
34 - void *ret = malloc(size);
35 + void *ret = calloc(1, size);
38 my_syslog(LOG_ERR, _("failed to allocate %d bytes"), (int) size);
40 - memset(ret, 0, size);