diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-07-20 13:42:13 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-07-24 07:57:39 -0700 |
| commit | ccc24a8e508131a2226474642a038baaa2cbcc8c (patch) | |
| tree | 7029f7668fe3e1a9899da57bf6c1e60e0394bacb /src/core/msgqueue.c | |
| parent | 9b9526e4a643d36d9c66f2254f00df7298e5562f (diff) | |
| download | nng-ccc24a8e508131a2226474642a038baaa2cbcc8c.tar.gz nng-ccc24a8e508131a2226474642a038baaa2cbcc8c.tar.bz2 nng-ccc24a8e508131a2226474642a038baaa2cbcc8c.zip | |
fixes #605 NNI_ALLOC_STRUCT/NNI_ALLOC_STRUCTS should zero memory
Diffstat (limited to 'src/core/msgqueue.c')
| -rw-r--r-- | src/core/msgqueue.c | 4 |
1 files changed, 2 insertions, 2 deletions
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); } |
