]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: session: do not free a session until no stream references it
authorWilly Tarreau <w@1wt.eu>
Tue, 27 Jun 2017 13:25:14 +0000 (15:25 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 18 Aug 2017 11:26:35 +0000 (13:26 +0200)
We now refrain from clearing a session's variables, counters, and from
releasing it as long as at least one stream references it. For now it
never happens but with H2 this will be mandatory to avoid double frees.

src/session.c

index a226559da237748c64b24945ab3174adec30c62d..06d3000e4203019ac71373331233d7f4b2e07213 100644 (file)
@@ -68,6 +68,8 @@ struct session *session_new(struct proxy *fe, struct listener *li, enum obj_type
 
 void session_free(struct session *sess)
 {
+       if (!LIST_ISEMPTY(&sess->streams))
+               return;
        session_store_counters(sess);
        vars_prune_per_sess(&sess->vars);
        pool_free2(pool2_session, sess);