1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

http_proxy: avoid freeing static memory

Follow up to 7fe81ec298: make sure 'host' is either NULL or malloced.
This commit is contained in:
Daniel Stenberg 2017-02-09 10:13:28 +01:00
parent 7fe81ec298
commit e2e182227a

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -199,7 +199,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
free(host_port); free(host_port);
if(!result) { if(!result) {
char *host=(char *)""; char *host = NULL;
const char *proxyconn=""; const char *proxyconn="";
const char *useragent=""; const char *useragent="";
const char *http = (conn->http_proxy.proxytype == CURLPROXY_HTTP_1_0) ? const char *http = (conn->http_proxy.proxytype == CURLPROXY_HTTP_1_0) ?
@ -242,7 +242,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
"%s", /* Proxy-Connection */ "%s", /* Proxy-Connection */
hostheader, hostheader,
http, http,
host, host?host:"",
conn->allocptr.proxyuserpwd? conn->allocptr.proxyuserpwd?
conn->allocptr.proxyuserpwd:"", conn->allocptr.proxyuserpwd:"",
useragent, useragent,