]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] stick_table: fix possible memory leak in case of connection error
authorWilly Tarreau <w@1wt.eu>
Sun, 6 Jun 2010 16:28:49 +0000 (18:28 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 14 Jun 2010 08:49:24 +0000 (10:49 +0200)
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.

src/session.c

index 5229c7fe2940385f8d49cb3e67896bcfdfae2c24..d5dbff247d7e86988f65d5fd2f072c13ffcf357c 100644 (file)
@@ -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);