GNOME Bugzilla – Bug 539292
memory leak in mpegtsparse
Last modified: 2008-07-07 13:24:43 UTC
There is a memory leak while posting new table in message bus. Valgrind trace : ==12848== ==12848== 7,469,553 (20,720 direct, 7,448,833 indirect) bytes in 1,035 blocks are definitely lost in loss record 25 of 28 ==12848== at 0x4021AA4: calloc (vg_replace_malloc.c:279) ==12848== by 0x415CA5D: g_malloc0 (in /usr/lib/libglib-2.0.so.0.1400.1) ==12848== by 0x408613A: gst_structure_id_empty_new_with_size (gststructure.c:116) ==12848== by 0x4086735: gst_structure_new_valist (gststructure.c:238) ==12848== by 0x40867B1: gst_structure_new (gststructure.c:209) ==12848== by 0x474B526: mpegts_packetizer_parse_eit (mpegtspacketizer.c:1344) ==12848== by 0x474A3EE: mpegts_parse_chain (mpegtsparse.c:1153) ==12848== by 0x4072698: gst_pad_chain_unchecked (gstpad.c:3503) ==12848== by 0x4072D51: gst_pad_push (gstpad.c:3671) ==12848== by 0x4733557: gst_queue_loop (gstqueue.c:991) ==12848== by 0x408C895: gst_task_func (gsttask.c:192) ==12848== by 0x417A0C7: (within /usr/lib/libglib-2.0.so.0.1400.1) ==12848==
Created attachment 113119 [details] [review] proposed patch. There is a copy of gst_structure which is never used and never released. The patch removes this useless copy...
The copy is necessary as gst_message_new_element takes the ownership of the structure. Some structures are still used after they are posted on the bus, see mpegts_parse_apply_pat for example. For consistency, I would unref the structures in mpegts_parse_handle_psi.
There is no ref/unref on gst_structures. Anyway I let you improve the patch in a better way.
You're right, I meant that they have to be free'd in mpegts_parse_handle_psi.
*** Bug 541087 has been marked as a duplicate of this bug. ***
Created attachment 113814 [details] [review] fix
Thanks, patch committed.