]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Cleanup the client to backend brigade before returning an error (if any) to avoid...
authorYann Ylavic <ylavic@apache.org>
Thu, 27 Feb 2014 13:05:24 +0000 (13:05 +0000)
committerYann Ylavic <ylavic@apache.org>
Thu, 27 Feb 2014 13:05:24 +0000 (13:05 +0000)
Suggested by rpluem.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1572543 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/proxy_util.c

index 6017b823c853a10e66ea122ac461b549a1bd24a3..73826691dd72521d69b3b4ff33fe7445610ee152 100644 (file)
@@ -3422,6 +3422,9 @@ PROXY_DECLARE(int) ap_proxy_pass_brigade(apr_bucket_alloc_t *bucket_alloc,
     if (transferred != -1)
         p_conn->worker->s->transferred += transferred;
     status = ap_pass_brigade(origin->output_filters, bb);
+    /* Cleanup the brigade now to avoid buckets lifetime
+     * issues in case of error returned below. */
+    apr_brigade_cleanup(bb);
     if (status != APR_SUCCESS) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(01084)
                       "pass request body failed to %pI (%s)",
@@ -3441,7 +3444,6 @@ PROXY_DECLARE(int) ap_proxy_pass_brigade(apr_bucket_alloc_t *bucket_alloc,
             return HTTP_BAD_REQUEST;
         }
     }
-    apr_brigade_cleanup(bb);
     return OK;
 }