]> git.ipfire.org Git - thirdparty/openssl.git/commit
ssl/quic/quic_record_tx.c: refactor qtx->cons obtaining
authorEugene Syromiatnikov <esyr@openssl.org>
Sun, 12 Apr 2026 12:33:08 +0000 (14:33 +0200)
committerTomas Mraz <tomas@openssl.foundation>
Wed, 29 Apr 2026 15:11:44 +0000 (17:11 +0200)
commitf33bb236fc44afe40a8b4787e14913f82d501dca
tree176e68fc62399c3f562fe45b59c9bcb647b781fc
parent95b31c03358962a2e03ae414f5d4e0925b553959
ssl/quic/quic_record_tx.c: refactor qtx->cons obtaining

As currently implemented, the only txe passed to qtx_reserve_txe()
(and, subsequently, to qtx_resize_txe()) is qtx->cons one, so the check
"if (qtx->cons == txe)" is superfluous, and, more so, would lead
to a memory leak if it weren't the case, as was spotted by Coverity.
Moreover, the set of qtx_alloc_txe(), qtx_ensure_free_txe(),
qtx_ensure_cons(), qtx_resize_txe(), and qtx_reserve_txe() functions,
while being written in a relatively generic way, is actually called
from a single call site in ossl_qtx_write_pkt(), and contains several
duplicating checks and unnecessary logic (like, adding a newly allocated
TXE to the free list, only to remove it from there right away
in qtx_ensure_cons(), the only its user), so just merge the whole
aforementioned set of functions (except qtx_alloc_txe()) in a single
function, qtx_get_cons_txe().

Resolves: https://scan5.scan.coverity.com/#/project-view/63999/10222?selectedIssue=1691460
Complements: 16892155e153 "quic: fix NULL txl dereference in qtx_resize_txe"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed Apr 29 15:12:14 2026
(Merged from https://github.com/openssl/openssl/pull/30783)
ssl/quic/quic_record_tx.c