mirror of
https://github.com/moparisthebest/curl
synced 2024-12-25 01:28:51 -05:00
http2: fix memory leaks on error-path
This commit is contained in:
parent
0d717a3106
commit
130c53b632
10
lib/http2.c
10
lib/http2.c
@ -2091,8 +2091,11 @@ CURLcode Curl_http2_setup(struct connectdata *conn)
|
|||||||
|
|
||||||
stream->stream_id = -1;
|
stream->stream_id = -1;
|
||||||
|
|
||||||
if(!stream->header_recvbuf)
|
if(!stream->header_recvbuf) {
|
||||||
stream->header_recvbuf = Curl_add_buffer_init();
|
stream->header_recvbuf = Curl_add_buffer_init();
|
||||||
|
if(!stream->header_recvbuf)
|
||||||
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
if((conn->handler == &Curl_handler_http2_ssl) ||
|
if((conn->handler == &Curl_handler_http2_ssl) ||
|
||||||
(conn->handler == &Curl_handler_http2))
|
(conn->handler == &Curl_handler_http2))
|
||||||
@ -2104,8 +2107,11 @@ CURLcode Curl_http2_setup(struct connectdata *conn)
|
|||||||
conn->handler = &Curl_handler_http2;
|
conn->handler = &Curl_handler_http2;
|
||||||
|
|
||||||
result = Curl_http2_init(conn);
|
result = Curl_http2_init(conn);
|
||||||
if(result)
|
if(result) {
|
||||||
|
Curl_add_buffer_free(stream->header_recvbuf);
|
||||||
|
stream->header_recvbuf = NULL;
|
||||||
return result;
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
infof(conn->data, "Using HTTP2, server supports multi-use\n");
|
infof(conn->data, "Using HTTP2, server supports multi-use\n");
|
||||||
stream->upload_left = 0;
|
stream->upload_left = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user