diff options
| author | Renato Westphal <renato@openbsd.org> | 2017-02-07 11:48:15 -0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-07 11:48:15 -0200 |
| commit | 62fb7b19e846b6ee641c8bf9d141cd6ed10b72e9 (patch) | |
| tree | be8895439fb42d71b731695c90cf5abf7784a7f1 | |
| parent | 1b4ae82d37fe06a9e6a7cac6a67aa5fb3beb777c (diff) | |
| parent | f0d975f752df74385fd268427d5f5cfef7ea9049 (diff) | |
Merge pull request #171 from donaldsharp/double_free
lib: Don't use malloc!
| -rw-r--r-- | lib/thread.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/thread.c b/lib/thread.c index 6ada7cd96a..5b8778b717 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 = XCALLOC (MTYPE_THREAD_MASTER, + sizeof (struct pollfd) * rv->handler.pfdsize); #endif return rv; } |
