[libdmapsharing] Fix some memory leaks identitifed while testing dmap-mdns-browser-dnssd.c Signed-off-by: W. Michael



commit aae69f3c21eca774f3fa0669a6d5ac0198bf95fc
Author: W. Michael Petullo <mike flyn org>
Date:   Thu Jul 7 17:30:22 2011 -0500

    Fix some memory leaks identitifed while testing dmap-mdns-browser-dnssd.c
    Signed-off-by: W. Michael Petullo <mike flyn org>

 libdmapsharing/dmap-mdns-browser-dnssd.c |    2 ++
 tests/test-daap-record.c                 |    6 ++++--
 tests/test-dmap-client.c                 |    3 +++
 3 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/libdmapsharing/dmap-mdns-browser-dnssd.c b/libdmapsharing/dmap-mdns-browser-dnssd.c
index ed1eed6..7c1c5b4 100644
--- a/libdmapsharing/dmap-mdns-browser-dnssd.c
+++ b/libdmapsharing/dmap-mdns-browser-dnssd.c
@@ -191,6 +191,7 @@ add_resolve_to_event_loop (ServiceContext *context)
 
 	int dns_sd_fd = DNSServiceRefSockFD (context->ref);
 
+	// FIXME: Memory leak?
 	GIOChannel *dns_sd_chan = g_io_channel_unix_new (dns_sd_fd);
 
 	if (!g_io_add_watch (dns_sd_chan,
@@ -259,6 +260,7 @@ add_browse_to_event_loop (DMAPMdnsBrowser *browser)
 
 	int dns_sd_fd = DNSServiceRefSockFD (browser->priv->sd_browse_ref);
 
+	// FIXME: Memory leak?
 	GIOChannel *dns_sd_chan = g_io_channel_unix_new (dns_sd_fd);
 
 	if (!g_io_add_watch (dns_sd_chan,
diff --git a/tests/test-daap-record.c b/tests/test-daap-record.c
index 6111933..e6a4c2e 100644
--- a/tests/test-daap-record.c
+++ b/tests/test-daap-record.c
@@ -296,12 +296,14 @@ test_daap_record_finalize (GObject *object)
 
 TestDAAPRecord *test_daap_record_new (void)
 {
-	gchar *ext;
+	gchar *ext, *dir;
 	TestDAAPRecord *record;
 
 	record = TEST_DAAP_RECORD (g_object_new (TYPE_TEST_DAAP_RECORD, NULL));
 
-	record->priv->location = g_strdup_printf ("file://%s/media/test.mp3", g_get_current_dir ());
+	dir = g_get_current_dir ();
+	record->priv->location = g_strdup_printf ("file://%s/media/test.mp3", dir);
+	g_free (dir);
 
 	record->priv->title = g_strdup ("Unknown");
 
diff --git a/tests/test-dmap-client.c b/tests/test-dmap-client.c
index c5256e7..8730177 100644
--- a/tests/test-dmap-client.c
+++ b/tests/test-dmap-client.c
@@ -47,6 +47,9 @@ print_record (gpointer id, DMAPRecord *record, gpointer user_data)
 		     NULL);
 
 	g_print ("%d: %s %s\n", GPOINTER_TO_UINT (id), artist, title);
+
+	g_free (artist);
+	g_free (title);
 }
 
 static void



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