]> granicus.if.org Git - apache/commitdiff
Avoid memory allocation before making sure that this handler can handle the URL
authorChristophe Jaillet <jailletc36@apache.org>
Wed, 18 May 2016 21:54:09 +0000 (21:54 +0000)
committerChristophe Jaillet <jailletc36@apache.org>
Wed, 18 May 2016 21:54:09 +0000 (21:54 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1744460 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy_http.c

index ced7301c1650df19d2dac4c6ddf5041bacd90c87..e21d7e26c4348a05468bb6343e5e128a3a39c9f9 100644 (file)
@@ -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,