From 33ddef36177bbf9aeb09581e83b2b41438dfec2b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 6 Apr 2021 17:24:31 +0200 Subject: [PATCH] ngtcp2+gnutls: clear credentials when freed ... to avoid double-free. Reported-by: Kenneth Davidson Fixes #6824 Closes #6856 --- lib/vquic/ngtcp2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/vquic/ngtcp2.c b/lib/vquic/ngtcp2.c index 9569431ca2..69dd14074f 100644 --- a/lib/vquic/ngtcp2.c +++ b/lib/vquic/ngtcp2.c @@ -873,8 +873,10 @@ static void qs_disconnect(struct quicsocket *qs) #endif qs->ssl = NULL; #ifdef USE_GNUTLS - if(qs->cred) + if(qs->cred) { gnutls_certificate_free_credentials(qs->cred); + qs->cred = NULL; + } #endif for(i = 0; i < 3; i++) Curl_safefree(qs->crypto_data[i].buf); -- 2.47.3