From f96872f001495b6ba8cd6e8ff0e4ea37f2ff0199 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 6 Feb 2017 12:52:28 -0500 Subject: [PATCH 1/2] lib: Don't use malloc! thread.c was using malloc. This was found by the assert added to memory.c. Fixes issues #170 Signed-off-by: Donald Sharp --- lib/thread.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/thread.c b/lib/thread.c index 6ada7cd96a40..e4b83eaf8608 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -489,8 +489,8 @@ thread_master_create (void) #if defined(HAVE_POLL) rv->handler.pfdsize = rv->fd_limit; rv->handler.pfdcount = 0; - rv->handler.pfds = (struct pollfd *) malloc (sizeof (struct pollfd) * rv->handler.pfdsize); - memset (rv->handler.pfds, 0, sizeof (struct pollfd) * rv->handler.pfdsize); + rv->handler.pfds = (struct pollfd *) XCALLOC (MTYPE_THREAD_MASTER, + sizeof (struct pollfd) * rv->handler.pfdsize); #endif return rv; } From f0d975f752df74385fd268427d5f5cfef7ea9049 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 7 Feb 2017 04:54:40 -0500 Subject: [PATCH 2/2] lib: Fixup CR comment Signed-off-by: Donald Sharp --- lib/thread.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/thread.c b/lib/thread.c index e4b83eaf8608..5b8778b71788 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -489,8 +489,8 @@ thread_master_create (void) #if defined(HAVE_POLL) rv->handler.pfdsize = rv->fd_limit; rv->handler.pfdcount = 0; - rv->handler.pfds = (struct pollfd *) XCALLOC (MTYPE_THREAD_MASTER, - sizeof (struct pollfd) * rv->handler.pfdsize); + rv->handler.pfds = XCALLOC (MTYPE_THREAD_MASTER, + sizeof (struct pollfd) * rv->handler.pfdsize); #endif return rv; }