From 1fe5c008d6e3080aa94bac22580a288822f1cc20 Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Thu, 18 May 2023 17:57:14 +0200 Subject: [PATCH] Ensure "wrap" variable is non-NULL RUNTIME_CHECK on the "wrap" variable avoids possible NULL dereference: thread.c: In function 'thread_wrap': thread.c:60:15: error: dereference of possibly-NULL 'wrap' [CWE-690] [-Werror=analyzer-possible-null-dereference] 60 | *wrap = (struct thread_wrap){ The RUNTIME_CHECK was there before 7d1ceaf35dbc25dfbca32deffa7f6ff8f452e75f. --- lib/isc/thread.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/isc/thread.c b/lib/isc/thread.c index 36ade47f1f..d0dc60c275 100644 --- a/lib/isc/thread.c +++ b/lib/isc/thread.c @@ -57,6 +57,7 @@ struct thread_wrap { static struct thread_wrap * thread_wrap(isc_threadfunc_t func, void *arg) { struct thread_wrap *wrap = malloc(sizeof(*wrap)); + RUNTIME_CHECK(wrap != NULL); *wrap = (struct thread_wrap){ .func = func, .arg = arg,