--- server/util_filter.c (revision 291602) +++ server/util_filter.c (working copy) @@ -578,8 +578,18 @@ 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* require that the flush function ensures that + * 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 in + * all cases. */ + apr_brigade_cleanup(bb); + + return rv; } AP_DECLARE(apr_status_t) ap_fflush(ap_filter_t *f, apr_bucket_brigade *bb)