summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2018-09-14 11:16:26 +0200
committerDaniel Stenberg <daniel@haxx.se>2018-09-16 23:22:15 +0200
commit130c53b632ca63f48b01bc048eda20c7512efd5c (patch)
treef8578a0fa266f5127485adfa3dd4a43d726a5f7b
parent0d717a3106e352a5339508bf6b24b87984bd8a82 (diff)
downloadcurl-130c53b632ca63f48b01bc048eda20c7512efd5c.tar.gz
http2: fix memory leaks on error-path
-rw-r--r--lib/http2.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/http2.c b/lib/http2.c
index f6d2672c8..7706e9459 100644
--- a/lib/http2.c
+++ b/lib/http2.c
@@ -2091,8 +2091,11 @@ CURLcode Curl_http2_setup(struct connectdata *conn)
stream->stream_id = -1;
- if(!stream->header_recvbuf)
+ if(!stream->header_recvbuf) {
stream->header_recvbuf = Curl_add_buffer_init();
+ if(!stream->header_recvbuf)
+ return CURLE_OUT_OF_MEMORY;
+ }
if((conn->handler == &Curl_handler_http2_ssl) ||
(conn->handler == &Curl_handler_http2))
@@ -2104,8 +2107,11 @@ CURLcode Curl_http2_setup(struct connectdata *conn)
conn->handler = &Curl_handler_http2;
result = Curl_http2_init(conn);
- if(result)
+ if(result) {
+ Curl_add_buffer_free(stream->header_recvbuf);
+ stream->header_recvbuf = NULL;
return result;
+ }
infof(conn->data, "Using HTTP2, server supports multi-use\n");
stream->upload_left = 0;