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

modules/proxy/mod_proxy_fcgi.c

index 23238f86922a04d1718516b61cb1f3cf8559e62f..864762e08a96500cb1c877bb21d44cdfbee7f551 100644 (file)
@@ -876,17 +876,17 @@ static int proxy_fcgi_handler(request_rec *r, proxy_worker *worker,
     char server_portstr[32];
     conn_rec *origin = NULL;
     proxy_conn_rec *backend = NULL;
+    apr_uri_t *uri;
 
     proxy_dir_conf *dconf = ap_get_module_config(r->per_dir_config,
                                                  &proxy_module);
 
     apr_pool_t *p = r->pool;
 
-    apr_uri_t *uri = apr_palloc(r->pool, sizeof(*uri));
 
     ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01076)
                   "url: %s proxyname: %s proxyport: %d",
-                 url, proxyname, proxyport);
+                  url, proxyname, proxyport);
 
     if (ap_casecmpstrn(url, "fcgi:", 5) != 0) {
         ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01077) "declining URL %s", url);
@@ -909,6 +909,7 @@ static int proxy_fcgi_handler(request_rec *r, proxy_worker *worker,
     backend->is_ssl = 0;
 
     /* Step One: Determine Who To Connect To */
+    uri = apr_palloc(p, sizeof(*uri));
     status = ap_proxy_determine_connection(p, r, conf, worker, backend,
                                            uri, &url, proxyname, proxyport,
                                            server_portstr,