comparison libpurple/protocols/msn/session.c @ 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 107166bb2a64
comparison
equal deleted inserted replaced
23675:da592864cae2 23676:8552b19acbce
55 { 55 {
56 g_return_if_fail(session != NULL); 56 g_return_if_fail(session != NULL);
57 57
58 session->destroying = TRUE; 58 session->destroying = TRUE;
59 59
60 if (session->soap_cleanup_handle)
61 purple_timeout_remove(session->soap_cleanup_handle);
62
63 if (session->soap_table != NULL)
64 g_hash_table_destroy(session->soap_table);
65
66 while (session->slplinks != NULL)
67 msn_slplink_destroy(session->slplinks->data);
68
69 while (session->switches != NULL)
70 msn_switchboard_destroy(session->switches->data);
71
72 if (session->sync != NULL)
73 msn_sync_destroy(session->sync);
74
75 if (session->oim != NULL)
76 msn_oim_destroy(session->oim);
77
78 if (session->nexus != NULL)
79 msn_nexus_destroy(session->nexus);
80
81 if (session->user != NULL)
82 msn_user_destroy(session->user);
83
84 if (session->notification != NULL)
85 msn_notification_destroy(session->notification);
86
60 if (session->connected) 87 if (session->connected)
61 msn_session_disconnect(session); 88 msn_session_disconnect(session);
62
63 if (session->notification != NULL)
64 msn_notification_destroy(session->notification);
65
66 while (session->switches != NULL)
67 msn_switchboard_destroy(session->switches->data);
68
69 while (session->slplinks != NULL)
70 msn_slplink_destroy(session->slplinks->data);
71 89
72 msn_userlist_destroy(session->userlist); 90 msn_userlist_destroy(session->userlist);
73 91
74 g_free(session->psm); 92 g_free(session->psm);
75 93
77 95
78 g_free(session->passport_info.kv); 96 g_free(session->passport_info.kv);
79 g_free(session->passport_info.sid); 97 g_free(session->passport_info.sid);
80 g_free(session->passport_info.mspauth); 98 g_free(session->passport_info.mspauth);
81 g_free(session->passport_info.client_ip); 99 g_free(session->passport_info.client_ip);
82
83 g_free(session->passport_info.mail_url); 100 g_free(session->passport_info.mail_url);
84
85 if (session->sync != NULL)
86 msn_sync_destroy(session->sync);
87
88 if (session->nexus != NULL)
89 msn_nexus_destroy(session->nexus);
90
91 if (session->oim != NULL)
92 msn_oim_destroy(session->oim);
93
94 if (session->user != NULL)
95 msn_user_destroy(session->user);
96
97 if (session->soap_table != NULL)
98 g_hash_table_destroy(session->soap_table);
99
100 if (session->soap_cleanup_handle)
101 purple_timeout_remove(session->soap_cleanup_handle);
102 101
103 g_free(session); 102 g_free(session);
104 } 103 }
105 104
106 gboolean 105 gboolean