ngtcp2: fix memory leak on connect failure

When a QUIC connection using ngtcp2 failed immediately, the TLS
instances were not always released.

Closes #16113
This commit is contained in:
Stefan Eissing 2025-01-28 13:23:31 +01:00 committed by Daniel Stenberg
parent f6da27052e
commit 399ca56be5
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -175,6 +175,8 @@ static void cf_ngtcp2_ctx_init(struct cf_ngtcp2_ctx *ctx)
static void cf_ngtcp2_ctx_free(struct cf_ngtcp2_ctx *ctx)
{
if(ctx && ctx->initialized) {
Curl_vquic_tls_cleanup(&ctx->tls);
vquic_ctx_free(&ctx->q);
Curl_bufcp_free(&ctx->stream_bufcp);
Curl_dyn_free(&ctx->scratch);
Curl_hash_clean(&ctx->streams);