[glib] Fix two leaks seen when using TLS connections



commit 784619bc3aeb0e4f4d0dcf1c6feb934eaa586841
Author: Dan Winship <danw gnome org>
Date:   Mon Apr 4 11:10:50 2011 -0400

    Fix two leaks seen when using TLS connections
    
    g_tls_certificate_list_new_from_file() was leaking the file contents,
    and GSource was leaking the GSourcePrivate structure that got
    created when using child sources.

 gio/gtlscertificate.c |    1 +
 glib/gmain.c          |    7 +++++++
 2 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gio/gtlscertificate.c b/gio/gtlscertificate.c
index 84a0c4e..134f7a1 100644
--- a/gio/gtlscertificate.c
+++ b/gio/gtlscertificate.c
@@ -421,6 +421,7 @@ g_tls_certificate_list_new_from_file (const gchar  *file,
       list = g_list_prepend (list, cert);
     }
 
+  g_free (contents);
   return g_list_reverse (list);
 }
 
diff --git a/glib/gmain.c b/glib/gmain.c
index d4f393e..718c36c 100644
--- a/glib/gmain.c
+++ b/glib/gmain.c
@@ -1700,6 +1700,13 @@ g_source_unref_internal (GSource      *source,
 
       g_slist_free (source->poll_fds);
       source->poll_fds = NULL;
+
+      if (source->priv)
+	{
+	  g_slice_free (GSourcePrivate, source->priv);
+	  source->priv = NULL;
+	}
+
       g_free (source);
     }
   



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