From: Willy Tarreau Date: Sun, 6 Jun 2010 16:28:49 +0000 (+0200) Subject: [BUG] stick_table: fix possible memory leak in case of connection error X-Git-Tag: v1.5-dev8~601 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a4cda67323319364b1a1e6a71e52b7aa41632156;p=thirdparty%2Fhaproxy.git [BUG] stick_table: fix possible memory leak in case of connection error If a "stick store-request" rule is present, an entry is preallocated during the request. However, if there is no response due to an error or to a redir mode server, we never release it. --- diff --git a/src/session.c b/src/session.c index 5229c7fe29..d5dbff247d 100644 --- a/src/session.c +++ b/src/session.c @@ -50,6 +50,7 @@ void session_free(struct session *s) struct http_txn *txn = &s->txn; struct proxy *fe = s->fe; struct bref *bref, *back; + int i; if (s->pend_pos) pendconn_free(s->pend_pos); @@ -82,6 +83,13 @@ void session_free(struct session *s) http_end_txn(s); + for (i = 0; i < s->store_count; i++) { + if (!s->store[i].ts) + continue; + stksess_free(s->store[i].table, s->store[i].ts); + s->store[i].ts = NULL; + } + if (fe) { pool_free2(fe->hdr_idx_pool, txn->hdr_idx.v); pool_free2(fe->rsp_cap_pool, txn->rsp.cap);