# HG changeset patch # User Elliott Sales de Andrade # Date 1314993058 0 # Node ID 60d8798069644f5e4008143c449b9f8f5adca1df # Parent c200251415d3865b103a8065ad908135fe6aecbe Be a bit more specific about removing non-local MSN objects, which HanzZ thinks should fix a leak somewhere. diff -r c200251415d3 -r 60d879806964 libpurple/protocols/msn/msg.c --- a/libpurple/protocols/msn/msg.c Fri Sep 02 18:05:24 2011 +0000 +++ b/libpurple/protocols/msn/msg.c Fri Sep 02 19:50:58 2011 +0000 @@ -970,7 +970,7 @@ msn_slplink_request_object(slplink, smile, got_emoticon, NULL, obj); } - msn_object_destroy(obj); + msn_object_destroy(obj, FALSE); obj = NULL; who = NULL; sha1 = NULL; @@ -1025,7 +1025,7 @@ slplink = msn_session_get_slplink(session, who); msn_slplink_request_object(slplink, data, got_wink_cb, NULL, obj); - msn_object_destroy(obj); + msn_object_destroy(obj, FALSE); } else if (!strcmp(id, "3")) { @@ -1045,7 +1045,7 @@ slplink = msn_session_get_slplink(session, who); msn_slplink_request_object(slplink, data, got_voiceclip_cb, NULL, obj); - msn_object_destroy(obj); + msn_object_destroy(obj, FALSE); } else if (!strcmp(id, "4")) { /* Action */ diff -r c200251415d3 -r 60d879806964 libpurple/protocols/msn/msn.c --- a/libpurple/protocols/msn/msn.c Fri Sep 02 18:05:24 2011 +0000 +++ b/libpurple/protocols/msn/msn.c Fri Sep 02 19:50:58 2011 +0000 @@ -1453,7 +1453,7 @@ static void msn_emoticon_destroy(MsnEmoticon *emoticon) { if (emoticon->obj) - msn_object_destroy(emoticon->obj); + msn_object_destroy(emoticon->obj, FALSE); g_free(emoticon->smile); g_free(emoticon); } diff -r c200251415d3 -r 60d879806964 libpurple/protocols/msn/object.c --- a/libpurple/protocols/msn/object.c Fri Sep 02 18:05:24 2011 +0000 +++ b/libpurple/protocols/msn/object.c Fri Sep 02 19:50:58 2011 +0000 @@ -103,7 +103,7 @@ if (obj->creator == NULL || obj->size == 0 || obj->type == 0 || obj->sha1d == NULL) { purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str); - msn_object_destroy(obj); + msn_object_destroy(obj, FALSE); return NULL; } @@ -111,12 +111,12 @@ /* Location/friendly are required for non-buddyicon objects */ if (obj->type != MSN_OBJECT_USERTILE) { purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str); - msn_object_destroy(obj); + msn_object_destroy(obj, FALSE); return NULL; /* Buddy icon object can contain Url/Url1 instead */ } else if (obj->url == NULL || obj->url1 == NULL) { purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str); - msn_object_destroy(obj); + msn_object_destroy(obj, FALSE); return NULL; } } @@ -193,10 +193,13 @@ } void -msn_object_destroy(MsnObject *obj) +msn_object_destroy(MsnObject *obj, gboolean only_remote) { g_return_if_fail(obj != NULL); + if (only_remote && obj->local) + return; + g_free(obj->creator); g_free(obj->location); g_free(obj->friendly); diff -r c200251415d3 -r 60d879806964 libpurple/protocols/msn/object.h --- a/libpurple/protocols/msn/object.h Fri Sep 02 18:05:24 2011 +0000 +++ b/libpurple/protocols/msn/object.h Fri Sep 02 19:50:58 2011 +0000 @@ -86,9 +86,10 @@ /** * Destroys an MsnObject structure. * - * @param obj The object structure. + * @param obj The object structure. + * @param only_remote Only destroy non-local objects. */ -void msn_object_destroy(MsnObject *obj); +void msn_object_destroy(MsnObject *obj, gboolean only_remote); /** * Outputs a string representation of an MsnObject. diff -r c200251415d3 -r 60d879806964 libpurple/protocols/msn/slpcall.c --- a/libpurple/protocols/msn/slpcall.c Fri Sep 02 18:05:24 2011 +0000 +++ b/libpurple/protocols/msn/slpcall.c Fri Sep 02 19:50:58 2011 +0000 @@ -485,7 +485,7 @@ if (img) purple_imgstore_ref(img); } - msn_object_destroy(obj); + msn_object_destroy(obj, FALSE); if (img != NULL) { /* DATA PREP */ diff -r c200251415d3 -r 60d879806964 libpurple/protocols/msn/user.c --- a/libpurple/protocols/msn/user.c Fri Sep 02 18:05:24 2011 +0000 +++ b/libpurple/protocols/msn/user.c Fri Sep 02 19:50:58 2011 +0000 @@ -76,7 +76,7 @@ } if (user->msnobj != NULL) - msn_object_destroy(user->msnobj); + msn_object_destroy(user->msnobj, FALSE); g_free(user->passport); g_free(user->friendly_name); @@ -588,8 +588,8 @@ { g_return_if_fail(user != NULL); - if (user->msnobj != NULL && !msn_object_find_local(msn_object_get_sha1(obj))) - msn_object_destroy(user->msnobj); + if (user->msnobj != NULL) + msn_object_destroy(user->msnobj, TRUE); user->msnobj = obj;