BUG/MINOR: mux-quic: fix free on qcs-new fail alloc
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 11 Oct 2023 15:32:04 +0000 (17:32 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 13 Oct 2023 06:52:29 +0000 (08:52 +0200)
commit10dab4af983630aadb134fc4fcc3f770b8f1a6b9
tree90b5d45645c4e01827c821e7f674e02b5c46d208
parent63a6f26a861b8cd3430d964317db1276544024c0
BUG/MINOR: mux-quic: fix free on qcs-new fail alloc

qcs_new() allocates several elements in intermediary steps. All elements
must first be properly initialized to be able to free qcs instance in
case of an intermediary failure.

Previously, qc_stream_desc allocation was done in the middle of
qcs_new() before some elements initializations. In case this fails, a
crash can happened as some elements are left uninitialized.

To fix this, move qc_stream_desc allocation at the end of qcs_new().
This ensures that all qcs elements are initialized first.

This should be backported up to 2.6.
src/mux_quic.c