summaryrefslogtreecommitdiffstats
path: root/monitor_mm.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2013-11-08 12:19:55 +1100
committerDamien Miller <djm@mindrot.org>2013-11-08 12:19:55 +1100
commit6c81fee693038de7d4a5559043350391db2a2761 (patch)
treee09e17a18e8556e3b2276b280fa2cd2f2c465f90 /monitor_mm.c
parent690d989008e18af3603a5e03f1276c9bad090370 (diff)
- djm@cvs.openbsd.org 2013/11/08 00:39:15
[auth-options.c auth2-chall.c authfd.c channels.c cipher-3des1.c] [clientloop.c gss-genr.c monitor_mm.c packet.c schnorr.c umac.c] [sftp-client.c sftp-glob.c] use calloc for all structure allocations; from markus@
Diffstat (limited to 'monitor_mm.c')
-rw-r--r--monitor_mm.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/monitor_mm.c b/monitor_mm.c
index ee7bad4b..d3e6aeee 100644
--- a/monitor_mm.c
+++ b/monitor_mm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor_mm.c,v 1.17 2013/05/17 00:13:13 djm Exp $ */
+/* $OpenBSD: monitor_mm.c,v 1.18 2013/11/08 00:39:15 djm Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -65,7 +65,7 @@ mm_make_entry(struct mm_master *mm, struct mmtree *head,
struct mm_share *tmp, *tmp2;
if (mm->mmalloc == NULL)
- tmp = xmalloc(sizeof(struct mm_share));
+ tmp = xcalloc(1, sizeof(struct mm_share));
else
tmp = mm_xmalloc(mm->mmalloc, sizeof(struct mm_share));
tmp->address = address;
@@ -88,7 +88,7 @@ mm_create(struct mm_master *mmalloc, size_t size)
struct mm_master *mm;
if (mmalloc == NULL)
- mm = xmalloc(sizeof(struct mm_master));
+ mm = xcalloc(1, sizeof(struct mm_master));
else
mm = mm_xmalloc(mmalloc, sizeof(struct mm_master));
@@ -161,6 +161,7 @@ mm_xmalloc(struct mm_master *mm, size_t size)
address = mm_malloc(mm, size);
if (address == NULL)
fatal("%s: mm_malloc(%lu)", __func__, (u_long)size);
+ memset(address, 0, size);
return (address);
}