From ccc24a8e508131a2226474642a038baaa2cbcc8c Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Fri, 20 Jul 2018 13:42:13 -0700 Subject: fixes #605 NNI_ALLOC_STRUCT/NNI_ALLOC_STRUCTS should zero memory --- src/core/msgqueue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/msgqueue.c') diff --git a/src/core/msgqueue.c b/src/core/msgqueue.c index 62f57553..e58fe6f5 100644 --- a/src/core/msgqueue.c +++ b/src/core/msgqueue.c @@ -57,7 +57,7 @@ nni_msgq_init(nni_msgq **mqp, unsigned cap) if ((mq = NNI_ALLOC_STRUCT(mq)) == NULL) { return (NNG_ENOMEM); } - if ((mq->mq_msgs = nni_alloc(sizeof(nng_msg *) * alloc)) == NULL) { + if ((mq->mq_msgs = nni_zalloc(sizeof(nng_msg *) * alloc)) == NULL) { NNI_FREE_STRUCT(mq); return (NNG_ENOMEM); } @@ -496,7 +496,7 @@ nni_msgq_resize(nni_msgq *mq, int cap) alloc = cap + 2; if (alloc > mq->mq_alloc) { - newq = nni_alloc(sizeof(nni_msg *) * alloc); + newq = nni_zalloc(sizeof(nni_msg *) * alloc); if (newq == NULL) { return (NNG_ENOMEM); } -- cgit v1.2.3-70-g09d2