From d4b62bff64c489785699ac83eb87a88399bebbc8 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 25 Dec 2025 18:06:37 +0100 Subject: [PATCH] curl_threads: don't do another malloc if the first fails Closes #20095 --- lib/curl_threads.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/curl_threads.c b/lib/curl_threads.c index 9e4bbc96ec..36a64eb8e3 100644 --- a/lib/curl_threads.c +++ b/lib/curl_threads.c @@ -54,8 +54,11 @@ curl_thread_t Curl_thread_create(CURL_THREAD_RETURN_T (CURL_STDCALL *func) (void *), void *arg) { curl_thread_t t = curlx_malloc(sizeof(pthread_t)); - struct Curl_actual_call *ac = curlx_malloc(sizeof(struct Curl_actual_call)); + struct Curl_actual_call *ac = NULL; int rc; + + if(t) + ac = curlx_malloc(sizeof(struct Curl_actual_call)); if(!(ac && t)) goto err;