From 3311c72eabc15fc3824cf09537785ccbb1c3b88f Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 20 Mar 2023 19:11:08 +0100 Subject: [PATCH] BUG/MEDIUM: stream: do not try to free a failed stream-conn In stream_free() if we fail to allocate s->scb() we go to the path where we try to free it, and it doesn't like being called with a null at all. It's easily reproducible with -dMfail,no-cache and "tune.fail-alloc 10" in the global section. This must be backported to 2.6. (cherry picked from commit a45e7e81ec54fd0562d8ab4776b4c05584d6d180) Signed-off-by: Amaury Denoyelle (cherry picked from commit 8daac8191313b625efeaf2799a4c05b585a44474) Signed-off-by: Amaury Denoyelle Conflict: NA Reference: https://git.haproxy.org/?p=haproxy-2.6.git;a=commit;h=3311c72eabc15fc3824cf09537785ccbb1c3b88f --- src/stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stream.c b/src/stream.c index 7eaf03995..224b9b8a2 100644 --- a/src/stream.c +++ b/src/stream.c @@ -575,8 +575,8 @@ struct stream *stream_new(struct session *sess, struct stconn *sc, struct buffer out_fail_accept: flt_stream_release(s, 0); LIST_DELETE(&s->list); - out_fail_alloc_scb: sc_free(s->scb); + out_fail_alloc_scb: out_fail_attach_scf: task_destroy(t); out_fail_alloc: -- 2.33.0