pidgin: 6a834614: Fix a possible null-dereference and/or m..

sadrul at pidgin.im sadrul at pidgin.im
Mon Sep 28 21:36:37 EDT 2009


-----------------------------------------------------------------
Revision: 6a834614341327cc0cbbdc3887692354df8999e3
Ancestor: 92ad55eb528d0648b91b5bbb14a0ef1c8a5288fa
Author: sadrul at pidgin.im
Date: 2009-09-28T17:41:56
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/6a834614341327cc0cbbdc3887692354df8999e3

Modified files:
        libpurple/protocols/yahoo/libymsg.c

ChangeLog: 

Fix a possible null-dereference and/or memory leak.

Yes, another diagnosis by clang-analyzer.

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/libymsg.c	a1a79930e90c8188fa7af0e23c190b87b45ce561
+++ libpurple/protocols/yahoo/libymsg.c	82a28a9c3f681d62bea34460a37d81006e2ae102
@@ -983,7 +983,10 @@ static void yahoo_process_message(Purple
 	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;
 	}
 


More information about the Commits mailing list