On Fri, Sep 12, 2014 at 4:57 PM, Yann Ylavic <ylavic....@gmail.com> wrote: > AP_DECLARE(apr_status_t) ap_filter_setaside_brigade(ap_filter_t *f, > ap_filter_aside_t **aside, > apr_bucket_brigade *bb) > { > if (!APR_BRIGADE_EMPTY(bb)) { > if (!*aside) { > *aside = apr_palloc(f->c->pool, sizeof **aside); > apr_pool_create(&(*aside)->pool, f->c->pool); > apr_pool_tag((*aside)->pool, "deferred_write"); > (*aside)->bb = NULL;
To avoid a (small) possible leak here, maybe replace this by : apr_pool_t *p; apr_pool_create(&p, f->c->pool); apr_pool_tag(p, "deferred_write"); *aside = apr_palloc(p, sizeof **aside); (*aside)->bb = NULL; (*aside)->pool = p; > } > if (!(*aside)->bb || APR_BRIGADE_EMPTY((*aside)->bb))) { > f->c->data_in_output_filters++; > } > if (bb != (*aside)->bb) { > return ap_save_brigade(f, &(*aside)->bb, &bb, (*aside)->pool); > } > } > else if ((*aside)->pool) { > /* > * There are no more requests in the pipeline. We can just clear the > * pool. > */ > ((*aside)->bb = NULL; > apr_pool_clear((*aside)->pool); And this by : apr_pool_t *p = (*aside)->pool; /* * There are no more requests in the pipeline. We can just clear the * pool. */ apr_pool_clear(p); *aside = apr_palloc(p, sizeof **aside); (*aside)->bb = NULL; (*aside)->pool = p; > } > return APR_SUCCESS; > } That wouldn't allow the use of *aside in a f->c->pool cleanup (post), but this seems unlikely.