# HG changeset patch # User Sadrul Habib Chowdhury # Date 1254159716 0 # Node ID dfabdc9cce88d2c2e788368bbd309cf0fca45f26 # Parent 7e2e95508a3a30a5bf438daf2b349d889a73a774 Fix a possible null-dereference and/or memory leak. Yes, another diagnosis by clang-analyzer. diff -r 7e2e95508a3a -r dfabdc9cce88 libpurple/protocols/yahoo/libymsg.c --- a/libpurple/protocols/yahoo/libymsg.c Mon Sep 28 17:39:33 2009 +0000 +++ b/libpurple/protocols/yahoo/libymsg.c Mon Sep 28 17:41:56 2009 +0000 @@ -983,7 +983,10 @@ if( (pkt_type == YAHOO_PKT_TYPE_P2P) && (val_11 != yd->session_id) ) { 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)"); /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */ - g_hash_table_remove(yd->peers, im->from); + if (im) { + g_hash_table_remove(yd->peers, im->from); + g_free(im); + } return; }