summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2017-11-01 14:36:15 +0100
committerDan Fandrich <dan@coneharvesters.com>2017-11-01 14:37:01 +0100
commit544bfdebea2a9e8be1c01fc7954cd49638fe2803 (patch)
treeb9b41411d6c4d74637e3c4e86b21fce925c00510
parent591f5d18cf5cb56a14439c3a7af77a418a462984 (diff)
downloadcurl-544bfdebea2a9e8be1c01fc7954cd49638fe2803.tar.gz
http2: Fixed OOM handling in upgrade request
This caused the torture tests on test 1800 to fail.
-rw-r--r--lib/http2.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/http2.c b/lib/http2.c
index 3a9e3be9a..5518a70ab 100644
--- a/lib/http2.c
+++ b/lib/http2.c
@@ -1183,14 +1183,17 @@ CURLcode Curl_http2_request_upgrade(Curl_send_buffer *req,
httpc->local_settings_num);
if(!binlen) {
failf(conn->data, "nghttp2 unexpectedly failed on pack_settings_payload");
+ Curl_add_buffer_free(req);
return CURLE_FAILED_INIT;
}
conn->proto.httpc.binlen = binlen;
result = Curl_base64url_encode(conn->data, (const char *)binsettings, binlen,
&base64, &blen);
- if(result)
+ if(result) {
+ Curl_add_buffer_free(req);
return result;
+ }
result = Curl_add_bufferf(req,
"Connection: Upgrade, HTTP2-Settings\r\n"