libpurple/protocols/novell/nmcontact.c

changeset 40052
cc03b5af25ea
parent 38358
30ba44276e74
child 40079
a37a1e349491
--- a/libpurple/protocols/novell/nmcontact.c	Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/novell/nmcontact.c	Wed Oct 16 01:06:17 2019 +0300
@@ -863,35 +863,17 @@
 static void
 _release_folder_contacts(NMFolder * folder)
 {
-	GSList *cnode;
-	NMContact *contact;
-
-	for (cnode = folder->contacts; cnode; cnode = cnode->next) {
-		contact = cnode->data;
-		cnode->data = NULL;
-		nm_release_contact(contact);
-	}
-
-	g_slist_free(folder->contacts);
+	g_slist_free_full(folder->contacts, (GDestroyNotify)nm_release_contact);
 	folder->contacts = NULL;
 }
 
 static void
 _release_folder_folders(NMFolder * folder)
 {
-	GSList *fnode;
-	NMFolder *subfolder;
-
 	if (folder == NULL)
 		return;
 
-	for (fnode = folder->folders; fnode; fnode = fnode->next) {
-		subfolder = fnode->data;
-		fnode->data = NULL;
-		nm_release_folder(subfolder);
-	}
-
-	g_slist_free(folder->folders);
+	g_slist_free_full(folder->folders, (GDestroyNotify)nm_release_folder);
 	folder->folders = NULL;
 }
 

mercurial