diff libpurple/protocols/bonjour/bonjour.c @ 19573:affacee881e8

Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times. Thanks to Lennart from the Avahi team for suggestions on how to improve the avahi implementation.
author Daniel Atallah <daniel.atallah@gmail.com>
date Sun, 02 Sep 2007 17:54:44 +0000
parents bc9b78ba996a
children 55d3f1622cf7
line wrap: on
line diff
--- a/libpurple/protocols/bonjour/bonjour.c	Sun Sep 02 14:40:04 2007 +0000
+++ b/libpurple/protocols/bonjour/bonjour.c	Sun Sep 02 17:54:44 2007 +0000
@@ -235,6 +235,13 @@
 	g_free(stripped);
 }
 
+static void bonjour_remove_buddy(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group) {
+	if (buddy->proto_data) {
+		bonjour_buddy_delete(buddy->proto_data);
+		buddy->proto_data = NULL;
+	}
+}
+
 static GList *
 bonjour_status_types(PurpleAccount *account)
 {
@@ -395,7 +402,7 @@
 	NULL,                                                    /* change_passwd */
 	NULL,                                                    /* add_buddy */
 	NULL,                                                    /* add_buddies */
-	NULL,                                                    /* remove_buddy */
+	bonjour_remove_buddy,                                    /* remove_buddy */
 	NULL,                                                    /* remove_buddies */
 	NULL,                                                    /* add_permit */
 	NULL,                                                    /* add_deny */