]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Don't use malloc!
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 6 Feb 2017 17:52:28 +0000 (12:52 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 6 Feb 2017 17:52:28 +0000 (12:52 -0500)
thread.c was using malloc.  This was found by the
assert added to memory.c.

Fixes issues #170

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/thread.c

index 6ada7cd96a40c6442f2e588397ff770bd9efbf32..e4b83eaf8608ff17b946d593c66056161e242aff 100644 (file)
@@ -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;
 }