changeset 12035:52eaf0f0db4c

[gaim-migrate @ 14328] data->session actually is being allocated 3 times - once in bonjour_dns_sd_new(), once in bonjour_dns_sd_start(), and once in sw_discovery_init() inside howl. This removes the first two unnecesssary allocations (which will leak). committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 10 Nov 2005 14:39:27 +0000
parents bad5f83e7f22
children 4fc3ea5a362d
files src/protocols/bonjour/dns_sd.c
diffstat 1 files changed, 1 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/bonjour/dns_sd.c	Thu Nov 10 14:30:28 2005 +0000
+++ b/src/protocols/bonjour/dns_sd.c	Thu Nov 10 14:39:27 2005 +0000
@@ -295,8 +295,7 @@
 BonjourDnsSd *
 bonjour_dns_sd_new()
 {
-	BonjourDnsSd *data = g_new(BonjourDnsSd, 1);
-	data->session = g_malloc(sizeof(sw_discovery));
+	BonjourDnsSd *data = g_new0(BonjourDnsSd, 1);
 
 	return data;
 }
@@ -307,7 +306,6 @@
 void
 bonjour_dns_sd_free(BonjourDnsSd *data)
 {
-	g_free(data->session);
 	g_free(data->first);
 	g_free(data->last);
 	g_free(data->email);
@@ -346,10 +344,8 @@
 	gc = gaim_account_get_connection(account);
 
 	/* Initialize the dns-sd data and session */
-	data->session = malloc(sizeof(sw_discovery));
 	if (sw_discovery_init(data->session) != SW_OKAY)
 	{
-		free(data->session);
 		data->session = NULL;
 		gaim_debug_error("bonjour", "Unable to initialize an mDNS session.\n");
 		return FALSE;