GNOME Bugzilla – Bug 733964
memory leak in gstplaybin2
Last modified: 2014-07-30 09:36:19 UTC
Created attachment 282002 [details] [review] patch for gstplaybin2 memory leak I think there is a memory leak in gstplaybin2.c when I checked the memory with valgrind, I got following: ==1219== 168 (72 direct, 96 indirect) bytes in 6 blocks are definitely lost in loss record 5,332 of 5,578 ==1219== at 0x4834024: malloc (vg_replace_malloc.c:291) ==1219== by 0x4BDC9F7: g_malloc (gmem.c:104) ==1219== by 0x4BF3D43: g_slice_alloc (gslice.c:1016) ==1219== by 0x4BD32EF: g_list_append (glist.c:232) ==1219== by 0x4BE766F: g_queue_push_tail (gqueue.c:419) ==1219== by 0x4A06FC3: gst_element_factory_list_filter (gstelementfactory.c:862) ==1219== by 0x5105A73: autoplug_factories_cb (gstplaybin2.c:3938) ==1219== by 0x4B86B47: ffi_call_VFP (sysv.S:391) in file gstplaybin2.c line 3974: factory_list = create_decoders_list (factory_list, *ave_list); this line reset factory_list, so gst_plugin_feature_list_free (factory_list); at the end of function will free the list which isn't the original list returned by gst_element_factory_list_filter() at line 3938. that may cause some nodes in the original list can't be freed. I made rough change to just record the original list and then free it at the end. with the changes in the attachment diff, the memory leak gone and valgrind check can be satisfied.
That's fixed since some time already, and the fix is also in 1.4.0. Thanks for providing the patch :) commit 57295753d54da55289f50d4b2585cb234d3fedd0 Author: Sebastian Dröge <sebastian@centricular.com> Date: Mon Feb 10 16:33:50 2014 +0100 playbin: Fix memory leak in autoplugging code We should not leak element factories ideally.