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

Mon, 28 Sep 2009 17:41:56 +0000

author
Sadrul Habib Chowdhury <sadrul@pidgin.im>
date
Mon, 28 Sep 2009 17:41:56 +0000
changeset 28602
5ac71d38bd5c
parent 28601
70feb3f9ae12
child 28603
11265cf9206f

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

Yes, another diagnosis by clang-analyzer.

libpurple/protocols/yahoo/libymsg.c file | annotate | diff | comparison | revisions
--- 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;
 	}
 

mercurial