# HG changeset patch # User Paul Aurich # Date 1266861218 0 # Node ID 6d2ba42595fe2f8785f4beb9aa228bcc9ffa7801 # Parent 551253814063021c23b43918ad8fed69ddc7ba2d 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] Destroying oscar connection of type 0x0002. Disconnect reason is 0 [02/22/10 17:11:51] 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] Scheduling destruction of FLAP connection of type 0x0002 [02/22/10 17:11:51] Signed off. ... [02/22/10 17:11:51] Destroying oscar connection of type 0x7261. Disconnect reason is 1668179315 diff -r 551253814063 -r 6d2ba42595fe libpurple/protocols/oscar/flap_connection.c --- a/libpurple/protocols/oscar/flap_connection.c Sun Feb 21 00:11:56 2010 +0000 +++ b/libpurple/protocols/oscar/flap_connection.c Mon Feb 22 17:53:38 2010 +0000 @@ -364,6 +364,12 @@ conn->connect_data = NULL; } + if (conn->gsc != NULL && conn->gsc->connect_data != NULL) + { + purple_ssl_close(conn->gsc); + conn->gsc = NULL; + } + if (conn->new_conn_data != NULL) { if (conn->type == SNAC_FAMILY_CHAT)