pidgin: 313a8935: Re-arrange msn_session_destroy to avoid ...
qulogic at pidgin.im
qulogic at pidgin.im
Fri Aug 8 02:11:00 EDT 2008
-----------------------------------------------------------------
Revision: 313a8935368ac818f1098323a148beae93f98bb8
Ancestor: b974feb703eea2b0af500108fb8839ca4277a988
Author: qulogic at pidgin.im
Date: 2008-08-08T03:34:28
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/313a8935368ac818f1098323a148beae93f98bb8
Modified files:
libpurple/protocols/msn/session.c
ChangeLog:
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
think this will actually fix anything, but maybe it does.
-------------- next part --------------
============================================================
--- libpurple/protocols/msn/session.c bb919b5947352f1dbf468580d7f4aec6abc70f3f
+++ libpurple/protocols/msn/session.c b3f34a2dd3ba29c2dc965f64c17b298bbcf0d7b6
@@ -57,18 +57,36 @@ msn_session_destroy(MsnSession *session)
session->destroying = TRUE;
- if (session->connected)
- msn_session_disconnect(session);
+ if (session->soap_cleanup_handle)
+ purple_timeout_remove(session->soap_cleanup_handle);
- if (session->notification != NULL)
- msn_notification_destroy(session->notification);
+ 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);
- while (session->slplinks != NULL)
- msn_slplink_destroy(session->slplinks->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);
+
+ if (session->connected)
+ msn_session_disconnect(session);
+
msn_userlist_destroy(session->userlist);
g_free(session->psm);
@@ -79,27 +97,8 @@ msn_session_destroy(MsnSession *session)
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);
}
More information about the Commits
mailing list