[libdmapsharing] Don't leak GIOChannels in DNS-SD backend.



commit 0ab3dba006a2b583b230d2bd51e02ec13b0fce31
Author: Daniel Svensson <dsvensson gmail com>
Date:   Fri Jul 8 08:16:07 2011 +0200

    Don't leak GIOChannels in DNS-SD backend.

 libdmapsharing/dmap-mdns-browser-dnssd.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/libdmapsharing/dmap-mdns-browser-dnssd.c b/libdmapsharing/dmap-mdns-browser-dnssd.c
index a06c966..d0545d9 100644
--- a/libdmapsharing/dmap-mdns-browser-dnssd.c
+++ b/libdmapsharing/dmap-mdns-browser-dnssd.c
@@ -200,7 +200,6 @@ 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,
@@ -209,6 +208,8 @@ add_resolve_to_event_loop (ServiceContext *context)
 		g_warning ("Error adding SD to event loop");
 	}
 
+	g_io_channel_unref (dns_sd_chan);
+
 	return TRUE;
 }
 
@@ -269,7 +270,6 @@ 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,
@@ -278,6 +278,8 @@ add_browse_to_event_loop (DMAPMdnsBrowser *browser)
 		g_error ("Error adding SD to event loop");
 	}
 
+	g_io_channel_unref (dns_sd_chan);
+
 	return TRUE;
 }
 



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