# HG changeset patch # User Mark Doliner # Date 1174842267 0 # Node ID d7feace39800737ed83361b095bced0fc0ed1088 # Parent 6a5089fafd193fed2e34da03e0bd715e2bb448a8 Fix some reads of invalid memory when shutting down bonjour when there are bonjour buddies in your buddy list. We were iterating through the blist and removing people as we go, which meant we were deleting bnode and then trying to access bnode->next diff -r 6a5089fafd19 -r d7feace39800 libpurple/protocols/bonjour/bonjour.c --- a/libpurple/protocols/bonjour/bonjour.c Sun Mar 25 07:34:51 2007 +0000 +++ b/libpurple/protocols/bonjour/bonjour.c Sun Mar 25 17:04:27 2007 +0000 @@ -58,7 +58,7 @@ { PurpleAccount *account = purple_connection_get_account(gc); PurpleBuddyList *blist; - PurpleBlistNode *gnode, *cnode, *bnode; + PurpleBlistNode *gnode, *cnode, *cnodenext, *bnode, *bnodenext; PurpleBuddy *buddy; blist = purple_get_blist(); @@ -70,12 +70,14 @@ { if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; - for (cnode = gnode->child; cnode; cnode = cnode->next) + for (cnode = gnode->child; cnode; cnode = cnodenext) { + cnodenext = cnode->next; if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) continue; - for (bnode = cnode->child; bnode; bnode = bnode->next) + for (bnode = cnode->child; bnode; bnode = bnodenext) { + bnodenext = bnode->next; if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; buddy = (PurpleBuddy *)bnode;