[glib-networking] gnutls: Ensure all private members of GTlsConnectionGnutls are freed



commit abd1a629c84fa33b6a1f6a56f6874fca717e08b6
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Wed Sep 17 13:10:29 2014 +0100

    gnutls: Ensure all private members of GTlsConnectionGnutls are freed
    
    Just to be on the safe side, ensure every private member of
    GTlsConnectionGnutls is freed when the object itself is finalised.
    
    implicit_handshake must always be NULL when finalize() is reached, as it
    holds a reference to the GTlsConnectionGnutls as its source object.
    However, it’s better to clear the member anyway, just in case this
    behaviour changes in future.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=736809

 tls/gnutls/gtlsconnection-gnutls.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/tls/gnutls/gtlsconnection-gnutls.c b/tls/gnutls/gtlsconnection-gnutls.c
index 348a32c..7e63412 100644
--- a/tls/gnutls/gtlsconnection-gnutls.c
+++ b/tls/gnutls/gtlsconnection-gnutls.c
@@ -319,6 +319,14 @@ g_tls_connection_gnutls_finalize (GObject *object)
   g_clear_error (&gnutls->priv->read_error);
   g_clear_error (&gnutls->priv->write_error);
 
+  /* This must always be NULL at this, as it holds a referehce to @gnutls as
+   * its source object. However, we clear it anyway just in case this changes
+   * in future. */
+  g_clear_object (&gnutls->priv->implicit_handshake);
+
+  g_clear_object (&gnutls->priv->read_cancellable);
+  g_clear_object (&gnutls->priv->write_cancellable);
+
   g_clear_object (&gnutls->priv->waiting_for_op);
   g_mutex_clear (&gnutls->priv->op_mutex);
 


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