httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jaillet...@apache.org
Subject svn commit: r1744460 - /httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
Date Wed, 18 May 2016 21:54:10 GMT
Author: jailletc36
Date: Wed May 18 21:54:09 2016
New Revision: 1744460

URL: http://svn.apache.org/viewvc?rev=1744460&view=rev
Log:
Avoid memory allocation before making sure that this handler can handle the URL

Modified:
    httpd/httpd/trunk/modules/proxy/mod_proxy_http.c

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_http.c?rev=1744460&r1=1744459&r2=1744460&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_http.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_http.c Wed May 18 21:54:09 2016
@@ -1952,12 +1952,12 @@ static int proxy_http_handler(request_re
      * 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_re
     }
 
     /* 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,



Mime
View raw message