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



commit 8b2933b526677add13f6553aaf2982c92e084d01
Author: Michael Catanzaro <mcatanzaro redhat com>
Date:   Wed Jun 23 15:53:19 2021 -0500

    gnutls: fix leak in privkey export

 tls/gnutls/gtlscertificate-gnutls.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/tls/gnutls/gtlscertificate-gnutls.c b/tls/gnutls/gtlscertificate-gnutls.c
index ea8f593..dc7e073 100644
--- a/tls/gnutls/gtlscertificate-gnutls.c
+++ b/tls/gnutls/gtlscertificate-gnutls.c
@@ -152,7 +152,7 @@ export_privkey (GTlsCertificateGnutls  *gnutls,
                 void                  **output_data,
                 size_t                 *output_size)
 {
-  gnutls_x509_privkey_t x509_privkey;
+  gnutls_x509_privkey_t x509_privkey = NULL;
   int status;
 
   if (!gnutls->key)
@@ -181,6 +181,9 @@ export_privkey (GTlsCertificateGnutls  *gnutls,
   g_free (*output_data);
 
 err:
+  if (x509_privkey)
+    gnutls_x509_privkey_deinit (x509_privkey);
+
   *output_data = NULL;
   *output_size = 0;
 }


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