comparison libpurple/protocols/yahoo/libymsg.c @ 28673:dfabdc9cce88

Fix a possible null-dereference and/or memory leak. Yes, another diagnosis by clang-analyzer.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 28 Sep 2009 17:41:56 +0000
parents 7e2e95508a3a
children 291c89bfe040 61856d0a2714 2cc15ca3c26d
comparison
equal deleted inserted replaced
28672:7e2e95508a3a 28673:dfabdc9cce88
981 981
982 /* disconnect the peer if connected through p2p and sends wrong value for session id */ 982 /* disconnect the peer if connected through p2p and sends wrong value for session id */
983 if( (pkt_type == YAHOO_PKT_TYPE_P2P) && (val_11 != yd->session_id) ) { 983 if( (pkt_type == YAHOO_PKT_TYPE_P2P) && (val_11 != yd->session_id) ) {
984 purple_debug_warning("yahoo","p2p: %s sent us message with wrong session id. Disconnecting p2p connection to peer\n", im ? im->from : "(im was null)"); 984 purple_debug_warning("yahoo","p2p: %s sent us message with wrong session id. Disconnecting p2p connection to peer\n", im ? im->from : "(im was null)");
985 /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */ 985 /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */
986 g_hash_table_remove(yd->peers, im->from); 986 if (im) {
987 g_hash_table_remove(yd->peers, im->from);
988 g_free(im);
989 }
987 return; 990 return;
988 } 991 }
989 992
990 /* TODO: It seems that this check should be per IM, not global */ 993 /* TODO: It seems that this check should be per IM, not global */
991 /* Check for the Doodle IMV */ 994 /* Check for the Doodle IMV */