diff options
author | Yang Tse <yangsita@gmail.com> | 2007-04-05 11:09:46 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2007-04-05 11:09:46 +0000 |
commit | c895dc8a19eacd53cbca7d443f2673cacf119919 (patch) | |
tree | 0c16edb1a4839a0858f7b2dd61936197c56d6e45 | |
parent | a0a79ce8533b7cf722bf1c91f0fd411f456d4568 (diff) |
runtests -t discovered this out of memory handling issues
-rw-r--r-- | lib/http.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/http.c b/lib/http.c index 884d7e3d2..b59779b1b 100644 --- a/lib/http.c +++ b/lib/http.c @@ -157,6 +157,8 @@ static CURLcode Curl_output_basic(struct connectdata *conn, bool proxy) proxy?"Proxy-":"", authorization); free(authorization); + if(!*userp) + return CURLE_OUT_OF_MEMORY; } else return CURLE_OUT_OF_MEMORY; @@ -1150,8 +1152,10 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, return CURLE_OUT_OF_MEMORY; host_port = aprintf("%s:%d", hostname, remote_port); - if(!host_port) + if(!host_port) { + free(req_buffer); return CURLE_OUT_OF_MEMORY; + } /* Setup the proxy-authorization header, if any */ result = Curl_http_output_auth(conn, (char *)"CONNECT", host_port, TRUE); @@ -1163,8 +1167,11 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, if(!checkheaders(data, "Host:")) { host = aprintf("Host: %s\r\n", host_port); - if(!host) + if(!host) { + free(req_buffer); + free(host_port); result = CURLE_OUT_OF_MEMORY; + } } if(!checkheaders(data, "Proxy-Connection:")) proxyconn = "Proxy-Connection: Keep-Alive\r\n"; |