GNOME Bugzilla – Bug 557710
Memory leak related to matroskamux's request pads
Last modified: 2009-01-23 08:43:41 UTC
I found two problems related to the request pads used by the matroskamux element. The first problem is that if you create a matroskamux element and add it to a pipeline, but never set the pipeline to playing, gst_matroska_pad_free() is never called and we leak memory. This can be fixed by using gst_collect_pads_add_pad_full() instead of gst_collect_pads_add_pad() and specifying gst_matroska_pad_free() as the destroy notifier. The second problem is if one actually tries to do the right thing and call gst_element_release_request_pad() on the requested pad from matroskamux. Then this will fail with a warning about an unknown pad. This is because the code in gst_matroska_mux_release_pad() only works for pads which currently have collected data (which of course will not happen if the pipeline hasn't been running...) gst_matroska_mux_release_pad() should always call gst_collect_pads_remove_pad() and gst_element_remove_pad() for all pads, regardless of whether they've collected any data or not. The attached patch should fix both of the problems described above.
Created attachment 121248 [details] [review] Fix two request pad releated problems in matroskamux
2008-10-27 Sebastian Dröge <sebastian.droege@collabora.co.uk> Patch by: Peter Kjellerstedt <pkj at axis com> * gst/matroska/matroska-mux.c: (gst_matroska_mux_reset), (gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad): Fix a memory leak when pads are requested but the pipeline never goes into PLAYING. Correctly remove request pads, no matter if they have collected data or not. Fixes bug #557710.