[glib-networking] gnutls: really fix leak in privkey export



commit 78f706542efe5390767c51fd7c6dac97d4d493ba
Author: Michael Catanzaro <mcatanzaro redhat com>
Date:   Wed Jun 23 16:01:40 2021 -0500

    gnutls: really fix leak in privkey export
    
    For some reason, the tests all time out for me when I run them locally
    with asan, so this is trial-and-error debugging....

 tls/gnutls/gtlscertificate-gnutls.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/tls/gnutls/gtlscertificate-gnutls.c b/tls/gnutls/gtlscertificate-gnutls.c
index dc7e073..7d9a1ff 100644
--- a/tls/gnutls/gtlscertificate-gnutls.c
+++ b/tls/gnutls/gtlscertificate-gnutls.c
@@ -176,16 +176,19 @@ export_privkey (GTlsCertificateGnutls  *gnutls,
                                              NULL, GNUTLS_PKCS_PLAIN,
                                              *output_data, output_size);
   if (status == 0)
-    return;
+    {
+      gnutls_x509_privkey_deinit (x509_privkey);
+      return;
+    }
 
   g_free (*output_data);
 
 err:
-  if (x509_privkey)
-    gnutls_x509_privkey_deinit (x509_privkey);
-
   *output_data = NULL;
   *output_size = 0;
+
+  if (x509_privkey)
+    gnutls_x509_privkey_deinit (x509_privkey);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]