]> git.feebdaed.xyz Git - 0xmirror/curl.git/commitdiff
curl_threads: don't do another malloc if the first fails
authorDaniel Stenberg <daniel@haxx.se>
Thu, 25 Dec 2025 17:06:37 +0000 (18:06 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 25 Dec 2025 21:14:39 +0000 (22:14 +0100)
Closes #20095

lib/curl_threads.c

index 9e4bbc96eca29f738b4ee3c5c56e8b0a6b0fdf19..36a64eb8e3a81842c40eacd2867f959dad723e28 100644 (file)
@@ -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;