# HG changeset patch # User masca@cpw.pidgin.im # Date 1277246668 0 # Node ID ede71a46ef165af6b9c7ae655bf58623fe836e3f # Parent e0dd17804079b68a84eac9af8cf5c4b376bfe2bc Destroy Parts when the SlpMessage is destroyed. diff -r e0dd17804079 -r ede71a46ef16 libpurple/protocols/msn/slpmsg.c --- a/libpurple/protocols/msn/slpmsg.c Tue Jun 22 22:44:13 2010 +0000 +++ b/libpurple/protocols/msn/slpmsg.c Tue Jun 22 22:44:28 2010 +0000 @@ -26,6 +26,7 @@ #include "debug.h" #include "slpmsg.h" +#include "slpmsg_part.h" #include "slplink.h" /************************************************************************** @@ -124,6 +125,22 @@ slplink->slp_msgs = g_list_remove(slplink->slp_msgs, slpmsg); + for (cur = slpmsg->parts; cur != NULL; cur = g_list_delete_link(cur, cur)) + { + /* Something is pointing to this slpmsg, so we should remove that + * pointer to prevent a crash. */ + /* Ex: a user goes offline and after that we receive an ACK */ + + MsnSlpMessagePart *part = cur->data; + + part->ack_cb = NULL; + part->nak_cb = NULL; + part->ack_data = NULL; + msn_slpmsgpart_destroy(part); + } + + slplink->slp_msgs = g_list_remove(slplink->slp_msgs, slpmsg); + g_free(slpmsg->header); g_free(slpmsg->footer);