]> granicus.if.org Git - curl/commitdiff
http2: Fix memory leak in push header array
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
Mon, 6 Jul 2015 13:16:27 +0000 (22:16 +0900)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 7 Jul 2015 10:33:41 +0000 (12:33 +0200)
lib/http.c

index f64a56546937ba98c579fdd12d3cee3188d82a33..b9e8047716c3fdebb6fd0949cd5a0874637ff56f 100644 (file)
@@ -176,6 +176,9 @@ static CURLcode http_disconnect(struct connectdata *conn, bool dead_connection)
   if(http) {
     Curl_add_buffer_free(http->header_recvbuf);
     http->header_recvbuf = NULL; /* clear the pointer */
+    for(; http->push_headers_used > 0; --http->push_headers_used) {
+      free(http->push_headers[http->push_headers_used - 1]);
+    }
     free(http->push_headers);
     http->push_headers = NULL;
   }
@@ -1494,6 +1497,9 @@ CURLcode Curl_http_done(struct connectdata *conn,
     DEBUGF(infof(data, "free header_recvbuf!!\n"));
     Curl_add_buffer_free(http->header_recvbuf);
     http->header_recvbuf = NULL; /* clear the pointer */
+    for(; http->push_headers_used > 0; --http->push_headers_used) {
+      free(http->push_headers[http->push_headers_used - 1]);
+    }
     free(http->push_headers);
     http->push_headers = NULL;
   }