Package: gst-plugins-bad1.0 Version: 1.2.4 wheezy-backports
Software for recording TV from DVB stick, using gst-plugins-bad1.0-1.2.4 package from "wheezy-backports" repository, eats in couple of days all memory available and fails. Leak seems to be present till current 1.3.x versions. Problem is in the "libgstmpegtsdemux.so" library - source file "mpegtspacketizer.c" is using "g_malloc" without corresponding "g_free". Valgrind output: ==1601== 2,940,057 bytes in 729 blocks are definitely lost in loss record 2,549 of 2,549 ==1601== at 0x4028308: malloc (vg_replace_malloc.c:263) ==1601== by 0x42FB42A: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.3200.4) ==1601== by 0x42FB7A2: g_malloc (in /lib/i386-linux-gnu/libglib-2.0.so.0.3200.4) ==1601== by 0x79612F7: mpegts_packetizer_push_section (mpegtspacketizer.c:1154) ==1601== by 0x79688D7: mpegts_base_chain (mpegtsbase.c:1179) ==1601== by 0x485FBDB: gst_pad_push_data (gstpad.c:3827) ==1601== by 0x792A467: gst_queue_loop (gstqueue.c:1118) ==1601== by 0x48937BF: gst_task_func (gsttask.c:317) ==1601== by 0x4894A17: default_func (gsttaskpool.c:68) ==1601== by 0x431A887: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.3200.4) ==1601== by 0x4319EB2: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.3200.4) ==1601== by 0x4B0BD4D: clone (clone.S:130) Quick and dirty fix, successfully tested on 1.2.4 version (use of "mpegts_packetizer_stream_free" would be probably better): ************************************************************** --- a/gst/mpegtsdemux/mpegtspacketizer.c 2014-02-14 12:53:21.000000000 +0100 +++ b/gst/mpegtsdemux/mpegtspacketizer.c 2014-06-25 00:24:25.118573067 +0200 @@ -957,6 +957,8 @@ packetizer->streams[packet->pid] = stream; } + stream->section_data = NULL; + GST_MEMDUMP ("Full packet data", packet->data, packet->data_end - packet->data); @@ -1197,11 +1199,17 @@ goto accumulate_data; out: + + if(stream != NULL && stream->section_data != NULL) + { + g_free(stream->section_data); + stream->section_data = NULL; + } + packet->data = data; *remaining = others; GST_DEBUG ("result: %p", res); - return res; } ************************************************************** System is an up-to-date "Debian Wheezy" distribution on "3.15.1" kernel.