GNOME Bugzilla – Bug 560644
ffmpegdec leaks memory when gst_ffmpegdec_open is not called
Last modified: 2008-12-03 17:44:07 UTC
Please describe the problem: Memory leaks from any ffmpeg decoder element which is created via the GStreamer element factory but not set into an actual pipeline and have its setcaps function called (for example). Steps to reproduce: 1. Create an element of any ffmpeg decoder element 2. Don't link it anywhere or set it to a different state 3. Unref the element Actual results: Memory leaks on the allocation of ffmpegdec->context and ffmpegdec->picture. Expected results: Does this happen every time? Other information: The problem is that the memory allocation is not parallel to the de-allocation (and relying on the ffmpegdec->opened flag is wrong).
Created attachment 122578 [details] [review] Proposed fix Just remove the check for the "opened" flag, if init is called then so will finalize!
Created attachment 123876 [details] [review] Alternate fix, checks pointers before unreffing and reinit to NULL I have the same leak on a simple pipeline with ffdec_mp3 which occurs systematically. It seems we can't rely on the openned condition. I propose an alternative which check the pointers and reinits them to NULL after the unref.
2008-12-03 Yotam Shtossel <sh.yotam@gmail.com> reviewed by: Edward Hervey <edward.hervey@collabora.co.uk> * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_finalize): Fix check for memory to free. Fixes #560644