mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-05-10 19:58:06 +00:00
BUG/MEDIUM: cache: free ressources in chn_end_analyze
Upon an aborted HTTP connection, or an error, the filter cache does not decrement the refcount and does not free the allocated ressources.
This commit is contained in:
parent
0542c8b39a
commit
49dc048c25
30
src/cache.c
30
src/cache.c
@ -139,6 +139,35 @@ cache_store_chn_start_analyze(struct stream *s, struct filter *filter, struct ch
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
cache_store_chn_end_analyze(struct stream *s, struct filter *filter, struct channel *chn)
|
||||||
|
{
|
||||||
|
struct cache_st *st = filter->ctx;
|
||||||
|
struct cache *cache = filter->config->conf;
|
||||||
|
struct shared_context *shctx = shctx_ptr(cache);
|
||||||
|
|
||||||
|
if (!(chn->flags & CF_ISRESP))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
/* Everything should be released in the http_end filter, but we need to do it
|
||||||
|
* there too, in case of errors */
|
||||||
|
|
||||||
|
if (st && st->first_block) {
|
||||||
|
|
||||||
|
shctx_lock(shctx);
|
||||||
|
shctx_row_dec_hot(shctx, st->first_block);
|
||||||
|
shctx_unlock(shctx);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (st) {
|
||||||
|
pool_free2(pool2_cache_st, st);
|
||||||
|
filter->ctx = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cache_store_http_headers(struct stream *s, struct filter *filter, struct http_msg *msg)
|
cache_store_http_headers(struct stream *s, struct filter *filter, struct http_msg *msg)
|
||||||
{
|
{
|
||||||
@ -892,6 +921,7 @@ struct flt_ops cache_ops = {
|
|||||||
|
|
||||||
/* Handle channels activity */
|
/* Handle channels activity */
|
||||||
.channel_start_analyze = cache_store_chn_start_analyze,
|
.channel_start_analyze = cache_store_chn_start_analyze,
|
||||||
|
.channel_end_analyze = cache_store_chn_end_analyze,
|
||||||
|
|
||||||
/* Filter HTTP requests and responses */
|
/* Filter HTTP requests and responses */
|
||||||
.http_headers = cache_store_http_headers,
|
.http_headers = cache_store_http_headers,
|
||||||
|
Loading…
Reference in New Issue
Block a user