ngtcp2: clean up after ngtcp2 in curl_global_cleanup

Frees the memory allocated by `ngtcp2_crypto_ossl_init`, thus making
Valgrind happy. Works for versions of ngtcp2 >= 1.24.0.

Ref: https://github.com/ngtcp2/ngtcp2/issues/2207

Closes #22363
This commit is contained in:
Pavel Sobolev 2026-07-21 21:47:33 +03:00 committed by Daniel Stenberg
parent 2c3200f578
commit 381c3d56e3
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 11 additions and 0 deletions

View file

@ -268,6 +268,7 @@ void curl_global_cleanup(void)
}
Curl_ssl_cleanup();
Curl_vquic_cleanup();
Curl_async_global_cleanup();
#ifdef _WIN32

View file

@ -67,6 +67,14 @@ int Curl_vquic_init(void)
return 1;
}
void Curl_vquic_cleanup(void)
{
#if defined(USE_NGTCP2) && defined(OPENSSL_QUIC_API2) && \
(NGTCP2_VERSION_NUM >= 0x011800)
ngtcp2_crypto_ossl_free();
#endif
}
void Curl_quic_ver(char *p, size_t len)
{
#if defined(USE_NGTCP2) && defined(USE_NGHTTP3)

View file

@ -33,6 +33,7 @@ struct Curl_addrinfo;
void Curl_quic_ver(char *p, size_t len);
int Curl_vquic_init(void);
void Curl_vquic_cleanup(void);
CURLcode Curl_qlogdir(struct Curl_easy *data,
unsigned char *scid,
@ -81,6 +82,7 @@ extern struct Curl_cftype Curl_cft_h3_proxy;
#else
#define Curl_vquic_init() 1
#define Curl_vquic_cleanup()
#endif /* !CURL_DISABLE_HTTP && USE_HTTP3 */
CURLcode Curl_conn_may_http3(struct Curl_easy *data,