]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
duphandle: also free 'outcurl->cookies' in error path
authorDaniel Stenberg <daniel@haxx.se>
Wed, 15 Nov 2023 10:48:32 +0000 (11:48 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 15 Nov 2023 14:35:16 +0000 (15:35 +0100)
Fixes memory-leak when OOM mid-function

Use plain free instead of safefree, since the entire struct is
freed below.

Remove some free calls that is already freed in Curl_freeset()

Closes #12329

lib/easy.c

index d1e7d9b31a51c10c37428a34e96ef063ade696cd..cf254ee555d785f183c66398a3c7c3de5fb679f2 100644 (file)
@@ -985,13 +985,10 @@ fail:
 
   if(outcurl) {
 #ifndef CURL_DISABLE_COOKIES
-    curl_slist_free_all(outcurl->state.cookielist);
-    outcurl->state.cookielist = NULL;
+    free(outcurl->cookies);
 #endif
-    Curl_safefree(outcurl->state.buffer);
+    free(outcurl->state.buffer);
     Curl_dyn_free(&outcurl->state.headerb);
-    Curl_safefree(outcurl->state.url);
-    Curl_safefree(outcurl->state.referer);
     Curl_altsvc_cleanup(&outcurl->asi);
     Curl_hsts_cleanup(&outcurl->hsts);
     Curl_freeset(outcurl);