From: Christophe Jaillet Date: Wed, 18 May 2016 21:54:09 +0000 (+0000) Subject: Avoid memory allocation before making sure that this handler can handle the URL X-Git-Tag: 2.5.0-alpha~1605 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28ebc75b2b2a416fe211657e4a1a4131eaf5f990;p=thirdparty%2Fapache%2Fhttpd.git Avoid memory allocation before making sure that this handler can handle the URL git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1744460 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/mod_proxy_http.c b/modules/proxy/mod_proxy_http.c index ced7301c165..e21d7e26c43 100644 --- a/modules/proxy/mod_proxy_http.c +++ b/modules/proxy/mod_proxy_http.c @@ -1952,12 +1952,12 @@ static int proxy_http_handler(request_rec *r, proxy_worker *worker, * and avoid a memory leak */ apr_pool_t *p = r->pool; - apr_uri_t *uri = apr_palloc(p, sizeof(*uri)); + apr_uri_t *uri; /* find the scheme */ u = strchr(url, ':'); if (u == NULL || u[1] != '/' || u[2] != '/' || u[3] == '\0') - return DECLINED; + return DECLINED; if ((u - url) > 14) return HTTP_BAD_REQUEST; scheme = apr_pstrmemdup(p, url, u - url); @@ -2018,6 +2018,7 @@ static int proxy_http_handler(request_rec *r, proxy_worker *worker, } /* Step One: Determine Who To Connect To */ + uri = apr_palloc(p, sizeof(*uri)); if ((status = ap_proxy_determine_connection(p, r, conf, worker, backend, uri, &locurl, proxyname, proxyport, server_portstr,