Mercurial > pidgin
comparison libpurple/protocols/msn/nexus.c @ 22832:f62a4a7fe365
Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
leaking.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Sat, 03 May 2008 23:51:43 +0000 |
parents | f5874552b8d5 |
children | d756a0477c06 |
comparison
equal
deleted
inserted
replaced
22831:0b11895cc564 | 22832:f62a4a7fe365 |
---|---|
50 msn_nexus_destroy(MsnNexus *nexus) | 50 msn_nexus_destroy(MsnNexus *nexus) |
51 { | 51 { |
52 if (nexus->challenge_data != NULL) | 52 if (nexus->challenge_data != NULL) |
53 g_hash_table_destroy(nexus->challenge_data); | 53 g_hash_table_destroy(nexus->challenge_data); |
54 | 54 |
55 g_free(nexus->challenge_data_str); | |
55 g_free(nexus); | 56 g_free(nexus); |
56 } | 57 } |
57 | 58 |
58 /************************************************************************** | 59 /************************************************************************** |
59 * Login | 60 * Login |
99 | 100 |
100 msn_twn_t = g_hash_table_lookup(nexus->challenge_data, "t"); | 101 msn_twn_t = g_hash_table_lookup(nexus->challenge_data, "t"); |
101 msn_twn_p = g_hash_table_lookup(nexus->challenge_data, "p"); | 102 msn_twn_p = g_hash_table_lookup(nexus->challenge_data, "p"); |
102 | 103 |
103 /*setup the t and p parameter for session*/ | 104 /*setup the t and p parameter for session*/ |
104 if (session->passport_info.t != NULL){ | 105 g_free(session->passport_info.t); |
105 g_free(session->passport_info.t); | |
106 } | |
107 session->passport_info.t = g_strdup(msn_twn_t); | 106 session->passport_info.t = g_strdup(msn_twn_t); |
108 | 107 |
109 if (session->passport_info.p != NULL) | 108 g_free(session->passport_info.p); |
110 g_free(session->passport_info.p); | |
111 session->passport_info.p = g_strdup(msn_twn_p); | 109 session->passport_info.p = g_strdup(msn_twn_p); |
112 | 110 |
113 cert_str = g_strdup_printf("t=%s&p=%s",msn_twn_t,msn_twn_p); | 111 cert_str = g_strdup_printf("t=%s&p=%s",msn_twn_t,msn_twn_p); |
114 msn_got_login_params(session, cert_str); | 112 msn_got_login_params(session, cert_str); |
115 | 113 |
131 msn_nexus_connect(MsnNexus *nexus) | 129 msn_nexus_connect(MsnNexus *nexus) |
132 { | 130 { |
133 MsnSession *session = nexus->session; | 131 MsnSession *session = nexus->session; |
134 char *ru,*lc,*id,*tw,*ct,*kpp,*kv,*ver,*rn,*tpf; | 132 char *ru,*lc,*id,*tw,*ct,*kpp,*kv,*ver,*rn,*tpf; |
135 char *fs0,*fs; | 133 char *fs0,*fs; |
136 char *username, *password; | 134 const char *username; |
135 char *password; | |
137 char *tail; | 136 char *tail; |
138 #ifdef NEXUS_LOGIN_TWN | 137 #ifdef NEXUS_LOGIN_TWN |
139 char *challenge_str; | 138 char *challenge_str; |
140 #else | 139 #else |
141 char *rst1_str,*rst2_str,*rst3_str; | 140 char *rst1_str,*rst2_str,*rst3_str; |
145 | 144 |
146 purple_debug_info("MSN Nexus","Starting Windows Live ID authentication\n"); | 145 purple_debug_info("MSN Nexus","Starting Windows Live ID authentication\n"); |
147 msn_session_set_login_step(session, MSN_LOGIN_STEP_GET_COOKIE); | 146 msn_session_set_login_step(session, MSN_LOGIN_STEP_GET_COOKIE); |
148 | 147 |
149 /*prepare the Windows Live ID authentication token*/ | 148 /*prepare the Windows Live ID authentication token*/ |
150 username = g_strdup(purple_account_get_username(session->account)); | 149 username = purple_account_get_username(session->account); |
151 password = g_strndup(purple_connection_get_password(session->account->gc), 16); | 150 password = g_strndup(purple_connection_get_password(session->account->gc), 16); |
152 | 151 |
153 lc = (char *)g_hash_table_lookup(nexus->challenge_data, "lc"); | 152 lc = (char *)g_hash_table_lookup(nexus->challenge_data, "lc"); |
154 id = (char *)g_hash_table_lookup(nexus->challenge_data, "id"); | 153 id = (char *)g_hash_table_lookup(nexus->challenge_data, "id"); |
155 tw = (char *)g_hash_table_lookup(nexus->challenge_data, "tw"); | 154 tw = (char *)g_hash_table_lookup(nexus->challenge_data, "tw"); |
168 * for when windows g_strdup_printf() implementation get NULL point,It crashed! | 167 * for when windows g_strdup_printf() implementation get NULL point,It crashed! |
169 */ | 168 */ |
170 if(!(lc && id && tw && ru && ct && kpp && kv && ver && tpf)){ | 169 if(!(lc && id && tw && ru && ct && kpp && kv && ver && tpf)){ |
171 purple_debug_error("MSN Nexus","WLM Authenticate Key Error!\n"); | 170 purple_debug_error("MSN Nexus","WLM Authenticate Key Error!\n"); |
172 msn_session_set_error(session, MSN_ERROR_AUTH, _("Windows Live ID authentication Failed")); | 171 msn_session_set_error(session, MSN_ERROR_AUTH, _("Windows Live ID authentication Failed")); |
173 g_free(username); | |
174 g_free(password); | 172 g_free(password); |
175 msn_nexus_destroy(nexus); | 173 msn_nexus_destroy(nexus); |
176 session->nexus = NULL; | 174 session->nexus = NULL; |
177 return; | 175 return; |
178 } | 176 } |