]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
ngtcp2: clean up after ngtcp2 in `curl_global_cleanup` master
authorPavel Sobolev <contact@paveloom.dev>
Tue, 21 Jul 2026 18:47:33 +0000 (21:47 +0300)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 22 Jul 2026 21:41:35 +0000 (23:41 +0200)
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

lib/easy.c
lib/vquic/vquic.c
lib/vquic/vquic.h

index fa67c906567aaf3f0790e28f226727a9d2136fde..7321e738782e782c4f8f48fc8e2c0ab4b2476c73 100644 (file)
@@ -268,6 +268,7 @@ void curl_global_cleanup(void)
   }
 
   Curl_ssl_cleanup();
+  Curl_vquic_cleanup();
   Curl_async_global_cleanup();
 
 #ifdef _WIN32
index 802ffb7d3055eb426642826b6db30824ffa1f197..1f5e5bc6b8b00acad3e53f169167d2ab791dce14 100644 (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)
index 8674a3001de99b9d99696185b3954c4959332cfe..f1363e2c0a76d1e783d442583f00555ac6f218d5 100644 (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,