You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2007/10/11 15:18:38 UTC

svn commit: r583817 - /httpd/httpd/trunk/server/util_filter.c

Author: jorton
Date: Thu Oct 11 06:18:38 2007
New Revision: 583817

URL: http://svn.apache.org/viewvc?rev=583817&view=rev
Log:
* server/util_filter.c (ap_filter_flush): Ensure that the brigade is
  empty before returning.

PR: 36780

Modified:
    httpd/httpd/trunk/server/util_filter.c

Modified: httpd/httpd/trunk/server/util_filter.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_filter.c?rev=583817&r1=583816&r2=583817&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util_filter.c (original)
+++ httpd/httpd/trunk/server/util_filter.c Thu Oct 11 06:18:38 2007
@@ -578,8 +578,19 @@
                                                 void *ctx)
 {
     ap_filter_t *f = ctx;
+    apr_status_t rv;
 
-    return ap_pass_brigade(f, bb);
+    rv = ap_pass_brigade(f, bb);
+
+    /* apr_brigade_write et all require that the flush callback
+     * ensures the brigade is empty upon return; otherwise the brigade
+     * may be left with a transient bucket whose contents have fallen
+     * out of scope.  Call cleanup here unconditionally, to avoid the
+     * issue even in error cases where some filter fails and leaves a
+     * non-empty brigade. */
+    apr_brigade_cleanup(bb);
+
+    return rv;
 }
 
 AP_DECLARE(apr_status_t) ap_fflush(ap_filter_t *f, apr_bucket_brigade *bb)