cd4fdd8
cd4fdd8
http://issues.apache.org/bugzilla/show_bug.cgi?id=36780
cd4fdd8
6590dbb
--- httpd-2.2.4/server/util_filter.c.oldflush
6590dbb
+++ httpd-2.2.4/server/util_filter.c
6590dbb
@@ -578,8 +578,18 @@ AP_DECLARE_NONSTD(apr_status_t) ap_filte
6590dbb
                                                 void *ctx)
6590dbb
 {
6590dbb
     ap_filter_t *f = ctx;
6590dbb
+    apr_status_t rv;
6590dbb
 
6590dbb
-    return ap_pass_brigade(f, bb);
6590dbb
+    rv = ap_pass_brigade(f, bb);
6590dbb
+
6590dbb
+    /* apr_brigade_write* require that the flush function ensures that
6590dbb
+     * the brigade is empty upon return; otherwise the brigade may be
6590dbb
+     * left with a transient bucket whose contents have fallen out of
6590dbb
+     * scope.  Call cleanup here unconditionally to avoid the issue in
6590dbb
+     * all cases. */
6590dbb
+    apr_brigade_cleanup(bb);
6590dbb
+
6590dbb
+    return rv;
6590dbb
 }
6590dbb
 
6590dbb
 AP_DECLARE(apr_status_t) ap_fflush(ap_filter_t *f, apr_bucket_brigade *bb)