Mercurial > pidgin
changeset 23676:8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
think this will actually fix anything, but maybe it does.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Fri, 08 Aug 2008 03:34:28 +0000 |
parents | da592864cae2 |
children | 331effbd1cc8 |
files | libpurple/protocols/msn/session.c |
diffstat | 1 files changed, 25 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/msn/session.c Fri Aug 08 02:26:25 2008 +0000 +++ b/libpurple/protocols/msn/session.c Fri Aug 08 03:34:28 2008 +0000 @@ -57,17 +57,35 @@ session->destroying = TRUE; - if (session->connected) - msn_session_disconnect(session); + if (session->soap_cleanup_handle) + purple_timeout_remove(session->soap_cleanup_handle); + + if (session->soap_table != NULL) + g_hash_table_destroy(session->soap_table); + + while (session->slplinks != NULL) + msn_slplink_destroy(session->slplinks->data); + + while (session->switches != NULL) + msn_switchboard_destroy(session->switches->data); + + if (session->sync != NULL) + msn_sync_destroy(session->sync); + + if (session->oim != NULL) + msn_oim_destroy(session->oim); + + if (session->nexus != NULL) + msn_nexus_destroy(session->nexus); + + if (session->user != NULL) + msn_user_destroy(session->user); if (session->notification != NULL) msn_notification_destroy(session->notification); - while (session->switches != NULL) - msn_switchboard_destroy(session->switches->data); - - while (session->slplinks != NULL) - msn_slplink_destroy(session->slplinks->data); + if (session->connected) + msn_session_disconnect(session); msn_userlist_destroy(session->userlist); @@ -79,27 +97,8 @@ g_free(session->passport_info.sid); g_free(session->passport_info.mspauth); g_free(session->passport_info.client_ip); - g_free(session->passport_info.mail_url); - if (session->sync != NULL) - msn_sync_destroy(session->sync); - - if (session->nexus != NULL) - msn_nexus_destroy(session->nexus); - - if (session->oim != NULL) - msn_oim_destroy(session->oim); - - if (session->user != NULL) - msn_user_destroy(session->user); - - if (session->soap_table != NULL) - g_hash_table_destroy(session->soap_table); - - if (session->soap_cleanup_handle) - purple_timeout_remove(session->soap_cleanup_handle); - g_free(session); }