From 35a6d7427b50831a76a6cdc3f354396a311f3e18 Mon Sep 17 00:00:00 2001 From: Erik Janssen Date: Thu, 6 Dec 2018 21:35:50 +0100 Subject: [PATCH] Fixed wrong check for malloc result, as found with cppcheck --- thpool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thpool.c b/thpool.c index f5696f0..065182c 100644 --- a/thpool.c +++ b/thpool.c @@ -282,7 +282,7 @@ int thpool_num_threads_working(thpool_* thpool_p){ static int thread_init (thpool_* thpool_p, struct thread** thread_p, int id){ *thread_p = (struct thread*)malloc(sizeof(struct thread)); - if (thread_p == NULL){ + if (*thread_p == NULL){ err("thread_init(): Could not allocate memory for thread\n"); return -1; }