pidgin: 2fed8454: oscar: Fix a leak in aim_tlvlist_add_cap...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Tue Dec 28 01:06:15 EST 2010


----------------------------------------------------------------------
Revision: 2fed8454b4b8c230e50baa091723fa2f28462b85
Parent:   6e71d7a1e310cbb6c06b36dfbfc0a3120e8a31af
Author:   darkrain42 at pidgin.im
Date:     12/28/10 00:57:57
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/2fed8454b4b8c230e50baa091723fa2f28462b85

Changelog: 

oscar: Fix a leak in aim_tlvlist_add_caps

==32109== 384 bytes in 2 blocks are definitely lost in loss record 17,065 of 18,342
==32109==    at 0x4C244E8: malloc (vg_replace_malloc.c:236)
==32109==    by 0x90D8534: g_malloc (gmem.c:132)
==32109==    by 0x1613A4F0: byte_stream_new (bstream.c:32)
==32109==    by 0x1615DF63: aim_tlvlist_add_caps (tlv.c:413)
==32109==    by 0x16144FE6: aim_locate_setcaps (family_locate.c:1361)
==32109==    by 0x16154CA2: purple_parse_locaterights (oscar.c:2806)
==32109==    by 0x1614632B: snachandler (family_locate.c:1251)
==32109==    by 0x1614B4D2: flap_connection_recv (flap_connection.c:776)

Changes against parent 6e71d7a1e310cbb6c06b36dfbfc0a3120e8a31af

  patched  libpurple/protocols/oscar/tlv.c

-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/tlv.c	a4bbc718d6611c6d61fbc732cafaadc88646b78a
+++ libpurple/protocols/oscar/tlv.c	6dc3f207aede8d748f485713cddf8d804b525f02
@@ -400,6 +400,7 @@ int aim_tlvlist_add_caps(GSList **list, 
  */
 int aim_tlvlist_add_caps(GSList **list, const guint16 type, const guint64 caps, const char *mood)
 {
+	int len;
 	ByteStream bs;
 	guint32 bs_size;
 	guint8 *data;
@@ -417,7 +418,11 @@ int aim_tlvlist_add_caps(GSList **list, 
 	if (data != NULL)
 		byte_stream_putraw(&bs, data, 16);
 
-	return aim_tlvlist_add_raw(list, type, byte_stream_curpos(&bs), bs.data);
+	len = aim_tlvlist_add_raw(list, type, byte_stream_curpos(&bs), bs.data);
+
+	byte_stream_destroy(&bs);
+
+	return len;
 }
 
 /**


More information about the Commits mailing list