From fb1f91389f3171680df4ec7ca842f0c9373a5529 Mon Sep 17 00:00:00 2001 From: Bent Cardan Date: Wed, 25 Mar 2015 21:50:29 -0400 Subject: [PATCH] fix regression in global.c --- core/global.c | 4 +--- utils/alloc.c | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/core/global.c b/core/global.c index 2ba4777..999dfc7 100644 --- a/core/global.c +++ b/core/global.c @@ -431,9 +431,7 @@ void *nn_reallocmsg (void *msg, size_t size) int nn_freemsg (void *msg) { - if (msg != NULL) { nn_chunk_free (msg); - } return 0; } @@ -469,7 +467,7 @@ struct nn_cmsghdr *nn_cmsg_nxthdr_ (const struct nn_msghdr *mhdr, if (headsz + sizeof (struct nn_cmsghdr) > sz || headsz + NN_CMSG_SPACE (next->cmsg_len) > sz) return NULL; - + /* Success. */ return next; } diff --git a/utils/alloc.c b/utils/alloc.c index e76525e..852e3bb 100644 --- a/utils/alloc.c +++ b/utils/alloc.c @@ -56,7 +56,7 @@ void *nn_alloc_ (size_t size, const char *name) { uint8_t *chunk; - chunk = calloc (sizeof (struct nn_alloc_hdr) + size, sizeof(uint8_t)); + chunk = malloc (sizeof (struct nn_alloc_hdr) + size); if (!chunk) return NULL; @@ -131,7 +131,7 @@ void nn_alloc_term (void) void *nn_alloc_ (size_t size) { - return calloc (size, sizeof(uint8_t)); + return malloc (size); } void *nn_realloc (void *ptr, size_t size)