From: Yann Ylavic Date: Thu, 27 Feb 2014 13:05:24 +0000 (+0000) Subject: Cleanup the client to backend brigade before returning an error (if any) to avoid... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b97c3b65ab9c97114ceb4fc189b33af08380cb3e;p=thirdparty%2Fapache%2Fhttpd.git Cleanup the client to backend brigade before returning an error (if any) to avoid buckets lifetime issues (backend connection's pool destroyed before request's one). PR 50335. Suggested by rpluem. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1572543 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index 6017b823c85..73826691dd7 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -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; }