summaryrefslogtreecommitdiff
path: root/monitor_mm.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2013-11-08 12:28:03 +1100
committerDamien Miller <djm@mindrot.org>2013-11-08 12:28:03 +1100
commit727a3bfd3b5943bef9a9fd02812e9a75758d6d26 (patch)
treec9465c196ba7c575797626192d06e35a787a5c7d /monitor_mm.c
parent13cfd6d68237ef844dd8e02cf9ed21268154a999 (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 ee7bad4b4..d3e6aeee5 100644
--- a/monitor_mm.c
+++ b/monitor_mm.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: monitor_mm.c,v 1.17 2013/05/17 00:13:13 djm Exp $ */ 1/* $OpenBSD: monitor_mm.c,v 1.18 2013/11/08 00:39:15 djm Exp $ */
2/* 2/*
3 * Copyright 2002 Niels Provos <provos@citi.umich.edu> 3 * Copyright 2002 Niels Provos <provos@citi.umich.edu>
4 * All rights reserved. 4 * All rights reserved.
@@ -65,7 +65,7 @@ mm_make_entry(struct mm_master *mm, struct mmtree *head,
65 struct mm_share *tmp, *tmp2; 65 struct mm_share *tmp, *tmp2;
66 66
67 if (mm->mmalloc == NULL) 67 if (mm->mmalloc == NULL)
68 tmp = xmalloc(sizeof(struct mm_share)); 68 tmp = xcalloc(1, sizeof(struct mm_share));
69 else 69 else
70 tmp = mm_xmalloc(mm->mmalloc, sizeof(struct mm_share)); 70 tmp = mm_xmalloc(mm->mmalloc, sizeof(struct mm_share));
71 tmp->address = address; 71 tmp->address = address;
@@ -88,7 +88,7 @@ mm_create(struct mm_master *mmalloc, size_t size)
88 struct mm_master *mm; 88 struct mm_master *mm;
89 89
90 if (mmalloc == NULL) 90 if (mmalloc == NULL)
91 mm = xmalloc(sizeof(struct mm_master)); 91 mm = xcalloc(1, sizeof(struct mm_master));
92 else 92 else
93 mm = mm_xmalloc(mmalloc, sizeof(struct mm_master)); 93 mm = mm_xmalloc(mmalloc, sizeof(struct mm_master));
94 94
@@ -161,6 +161,7 @@ mm_xmalloc(struct mm_master *mm, size_t size)
161 address = mm_malloc(mm, size); 161 address = mm_malloc(mm, size);
162 if (address == NULL) 162 if (address == NULL)
163 fatal("%s: mm_malloc(%lu)", __func__, (u_long)size); 163 fatal("%s: mm_malloc(%lu)", __func__, (u_long)size);
164 memset(address, 0, size);
164 return (address); 165 return (address);
165} 166}
166 167