From: Willy Tarreau Date: Tue, 27 Jun 2017 13:25:14 +0000 (+0200) Subject: MEDIUM: session: do not free a session until no stream references it X-Git-Tag: v1.8-dev3~170 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f92a73d2fcdfe4afa974aed1c94a9ad75b694b41;p=thirdparty%2Fhaproxy.git MEDIUM: session: do not free a session until no stream references it 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. --- diff --git a/src/session.c b/src/session.c index a226559da2..06d3000e42 100644 --- a/src/session.c +++ b/src/session.c @@ -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);