]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
c-hyper: fix another memory leak in `Curl_http`.
authorNicholas Nethercote <n.nethercote@gmail.com>
Fri, 25 Aug 2023 08:40:31 +0000 (18:40 +1000)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 25 Aug 2023 13:27:22 +0000 (15:27 +0200)
There is a `hyper_clientconn_free` call on the happy path, but not one
on the error path. This commit adds one.

Fixes the second memory leak reported by Valgrind in #10803.

Fixes #10803
Closes #11729

lib/c-hyper.c

index ebb885669b7a270cfae1612ac0c4789a5be2b0af..808e4e11725c837564ea9f0b341b6bd3ceb545a8 100644 (file)
@@ -1217,6 +1217,7 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
   }
 
   hyper_clientconn_free(client);
+  client = NULL;
 
   if((httpreq == HTTPREQ_GET) || (httpreq == HTTPREQ_HEAD)) {
     /* HTTP GET/HEAD download */
@@ -1245,6 +1246,9 @@ error:
   if(handshake)
     hyper_task_free(handshake);
 
+  if(client)
+    hyper_clientconn_free(client);
+
   if(req)
     hyper_request_free(req);