This is caused incorrect err cleanup of mutex even if ql does not exist
(allocation failed).
It also fixes missing freeing of ports that result in assertion failure
because engine port list is not empty.
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu May 21 08:52:14 2026
(Merged from https://github.com/openssl/openssl/pull/31112)
if ((ql = OPENSSL_zalloc(sizeof(*ql))) == NULL) {
QUIC_RAISE_NON_NORMAL_ERROR(NULL, ERR_R_CRYPTO_LIB, NULL);
- goto err;
+ return NULL;
}
#if defined(OPENSSL_THREADS)
return &ql->obj.ssl;
err:
- if (ql != NULL)
- ossl_quic_engine_free(ql->engine);
+ ossl_quic_port_free(ql->port);
+ ossl_quic_engine_free(ql->engine);
#if defined(OPENSSL_THREADS)
ossl_crypto_mutex_free(&ql->mutex);