[glib-networking/mcatanzaro/base-rebase: 38/45] Do not leak peer certificate on gnutls



commit 9af059c9f648d1b0ba56856c994e2b224dc15157
Author: Ignacio Casal Quinteiro <qignacio amazon com>
Date:   Fri May 10 11:49:30 2019 +0200

    Do not leak peer certificate on gnutls

 tls/base/gtlsconnection-base.c       | 1 +
 tls/openssl/gtlsconnection-openssl.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/tls/base/gtlsconnection-base.c b/tls/base/gtlsconnection-base.c
index e2bf206..bf8d8ad 100644
--- a/tls/base/gtlsconnection-base.c
+++ b/tls/base/gtlsconnection-base.c
@@ -1221,6 +1221,7 @@ update_peer_certificate_and_compute_errors (GTlsConnectionBase *tls)
   g_set_object (&priv->peer_certificate, peer_certificate);
 
   priv->peer_certificate_errors = peer_certificate_errors;
+  g_object_unref (peer_certifiate);
 
   g_object_notify (G_OBJECT (tls), "peer-certificate");
   g_object_notify (G_OBJECT (tls), "peer-certificate-errors");
diff --git a/tls/openssl/gtlsconnection-openssl.c b/tls/openssl/gtlsconnection-openssl.c
index ae999e3..eed8c25 100644
--- a/tls/openssl/gtlsconnection-openssl.c
+++ b/tls/openssl/gtlsconnection-openssl.c
@@ -254,7 +254,7 @@ g_tls_connection_openssl_retrieve_peer_certificate (GTlsConnectionBase *tls)
 
   priv = g_tls_connection_openssl_get_instance_private (openssl);
 
-  return priv->peer_certificate;
+  return g_object_ref (priv->peer_certificate);
 }
 
 static int


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