comparison libpurple/protocols/oscar/tlv.c @ 31520:9b55bc3e2640

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)
author Paul Aurich <paul@darkrain42.org>
date Tue, 28 Dec 2010 05:57:57 +0000
parents be056399ae5f
children
comparison
equal deleted inserted replaced
31519:0c0b94fb9ac7 31520:9b55bc3e2640
398 * @param caps Bitfield of capability flags to send 398 * @param caps Bitfield of capability flags to send
399 * @return The size of the value added. 399 * @return The size of the value added.
400 */ 400 */
401 int aim_tlvlist_add_caps(GSList **list, const guint16 type, const guint64 caps, const char *mood) 401 int aim_tlvlist_add_caps(GSList **list, const guint16 type, const guint64 caps, const char *mood)
402 { 402 {
403 int len;
403 ByteStream bs; 404 ByteStream bs;
404 guint32 bs_size; 405 guint32 bs_size;
405 guint8 *data; 406 guint8 *data;
406 407
407 if (caps == 0) 408 if (caps == 0)
415 416
416 /* adding of custom icon GUID */ 417 /* adding of custom icon GUID */
417 if (data != NULL) 418 if (data != NULL)
418 byte_stream_putraw(&bs, data, 16); 419 byte_stream_putraw(&bs, data, 16);
419 420
420 return aim_tlvlist_add_raw(list, type, byte_stream_curpos(&bs), bs.data); 421 len = aim_tlvlist_add_raw(list, type, byte_stream_curpos(&bs), bs.data);
422
423 byte_stream_destroy(&bs);
424
425 return len;
421 } 426 }
422 427
423 /** 428 /**
424 * Adds the given chatroom info to a TLV chain. 429 * Adds the given chatroom info to a TLV chain.
425 * 430 *