comparison libpurple/protocols/oscar/flap_connection.c @ 29871:6d2ba42595fe

oscar: Fix a race condition that leads to a crash. With SSL enabled, if we start connecting and something calls purple_account_disconnect between when an SSL flap connection is started and when the connection is actually established, it isn't properly cleaned up (and we try to close the flap), which leads to free-after-use. You can simulate this by adding a timeout-triggered disconnect to the end of oscar_connect_to_bos. [02/22/10 17:11:51] <libpurple/oscar> Destroying oscar connection of type 0x0002. Disconnect reason is 0 [02/22/10 17:11:51] <libpurple/oscar> Disconnected. Code is 0x0000 and msg is (hiicq:17126): GLib-WARNING **: giounix.c:400Error while getting flags for FD: Bad file descriptor (9) [02/22/10 17:11:51] <libpurple/oscar> Scheduling destruction of FLAP connection of type 0x0002 [02/22/10 17:11:51] <libpurple/oscar> Signed off. ... [02/22/10 17:11:51] <libpurple/oscar> Destroying oscar connection of type 0x7261. Disconnect reason is 1668179315
author Paul Aurich <paul@darkrain42.org>
date Mon, 22 Feb 2010 17:53:38 +0000
parents 4d50162d809e
children 553cd883a29a
comparison
equal deleted inserted replaced
29868:551253814063 29871:6d2ba42595fe
360 { 360 {
361 if (conn->connect_data != NULL) 361 if (conn->connect_data != NULL)
362 { 362 {
363 purple_proxy_connect_cancel(conn->connect_data); 363 purple_proxy_connect_cancel(conn->connect_data);
364 conn->connect_data = NULL; 364 conn->connect_data = NULL;
365 }
366
367 if (conn->gsc != NULL && conn->gsc->connect_data != NULL)
368 {
369 purple_ssl_close(conn->gsc);
370 conn->gsc = NULL;
365 } 371 }
366 372
367 if (conn->new_conn_data != NULL) 373 if (conn->new_conn_data != NULL)
368 { 374 {
369 if (conn->type == SNAC_FAMILY_CHAT) 375 if (conn->type == SNAC_FAMILY_CHAT)