]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/dnsmasq/002-Zero_newly_malloc_ed_memory.patch
unbound: Rewrite configuration and initscript
[ipfire-2.x.git] / src / patches / dnsmasq / 002-Zero_newly_malloc_ed_memory.patch
CommitLineData
754efda1
MF
1From d55f81f5fd53b1dfc2c4b3249b542f2d9679e236 Mon Sep 17 00:00:00 2001
2From: Simon Kelley <simon@thekelleys.org.uk>
3Date: Wed, 6 Jul 2016 21:33:56 +0100
4Subject: [PATCH] Zero newly malloc'ed memory.
5
6---
7 src/util.c | 6 +++++-
8 1 file changed, 5 insertions(+), 1 deletion(-)
9
10diff --git a/src/util.c b/src/util.c
11index 93b24f5..82443c9 100644
12--- a/src/util.c
13+++ b/src/util.c
14@@ -248,6 +248,8 @@ void *safe_malloc(size_t size)
15
16 if (!ret)
17 die(_("could not get memory"), NULL, EC_NOMEM);
18+ else
19+ memset(ret, 0, size);
20
21 return ret;
22 }
23@@ -266,7 +268,9 @@ void *whine_malloc(size_t size)
24
25 if (!ret)
26 my_syslog(LOG_ERR, _("failed to allocate %d bytes"), (int) size);
27-
28+ else
29+ memset(ret, 0, size);
30+
31 return ret;
32 }
33
34--
351.7.10.4
36