From fdea2be62fbbb2eb592c2f6c75a23db7fd81a851 Mon Sep 17 00:00:00 2001 From: Yann Ylavic Date: Fri, 13 Jul 2018 16:04:37 +0000 Subject: [PATCH] util_filter: follow up to r1835640: pending_filter_cleanup() precedence. Register pending_filter_cleanup() as a normal cleanup (not pre_cleanup) so that the pending filters are still there on pool cleanup, and f->bb is set to NULL where needed. Then is_pending_filter() check is moved where relevant. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1835847 13f79535-47bb-0310-9956-ffa450edef68 --- server/util_filter.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/server/util_filter.c b/server/util_filter.c index ecbb025ea0..ff36a13553 100644 --- a/server/util_filter.c +++ b/server/util_filter.c @@ -458,10 +458,9 @@ static apr_status_t pending_filter_cleanup(void *arg) { ap_filter_t *f = arg; - if (is_pending_filter(f)) { - APR_RING_REMOVE(f, pending); - APR_RING_ELEM_INIT(f, pending); - } + APR_RING_REMOVE(f, pending); + APR_RING_ELEM_INIT(f, pending); + f->bb = NULL; return APR_SUCCESS; } @@ -472,7 +471,9 @@ static void remove_any_filter(ap_filter_t *f, ap_filter_t **r_filt, ap_filter_t ap_filter_t **curr = r_filt ? r_filt : c_filt; ap_filter_t *fscan = *curr; - pending_filter_cleanup(f); + if (is_pending_filter(f)) { + apr_pool_cleanup_run(f->c->pool, f, pending_filter_cleanup); + } if (p_filt && *p_filt == f) *p_filt = (*p_filt)->next; @@ -724,7 +725,8 @@ AP_DECLARE(int) ap_filter_prepare_brigade(ap_filter_t *f, apr_pool_t **p) } if (!f->bb) { f->bb = apr_brigade_create(pool, f->c->bucket_alloc); - apr_pool_pre_cleanup_register(pool, f, pending_filter_cleanup); + apr_pool_cleanup_register(pool, f, pending_filter_cleanup, + apr_pool_cleanup_null); } if (is_pending_filter(f)) { return DECLINED; -- 2.50.1