]> 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:46:42 +0000 (21:46 +0000)
committerChristophe Jaillet <jailletc36@apache.org>
Wed, 18 May 2016 21:46:42 +0000 (21:46 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1744459 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy_scgi.c

index 224d1ef123334f4de7f42c8104fc2a1c8884eb88..983f9ba28e91255e482a512f9ac68df13ba8ffcc 100644 (file)
@@ -509,7 +509,7 @@ static int scgi_request_status(int *status, request_rec *r)
                     *status = HTTP_INTERNAL_SERVER_ERROR;
                     return *status;
                 }
-            } while(0);
+            } while (0);
 
             return OK;
             /* break; */
@@ -530,7 +530,7 @@ static int scgi_handler(request_rec *r, proxy_worker *worker,
     int status;
     proxy_conn_rec *backend = NULL;
     apr_pool_t *p = r->pool;
-    apr_uri_t *uri = apr_palloc(r->pool, sizeof(*uri));
+    apr_uri_t *uri;
     char dummy;
 
     if (ap_casecmpstrn(url, SCHEME "://", sizeof(SCHEME) + 2)) {
@@ -548,6 +548,7 @@ static int scgi_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,
                                            &dummy, 1);