After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 560644 - ffmpegdec leaks memory when gst_ffmpegdec_open is not called
ffmpegdec leaks memory when gst_ffmpegdec_open is not called
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-libav
0.10.5
Other All
: Normal normal
: 0.10.7
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-11-13 14:11 UTC by Yotam Shtossel
Modified: 2008-12-03 17:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed fix (576 bytes, patch)
2008-11-13 14:16 UTC, Yotam Shtossel
none Details | Review
Alternate fix, checks pointers before unreffing and reinit to NULL (838 bytes, patch)
2008-12-03 14:55 UTC, vanista
committed Details | Review

Description Yotam Shtossel 2008-11-13 14:11:31 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).
Comment 1 Yotam Shtossel 2008-11-13 14:16:49 UTC
Created attachment 122578 [details] [review]
Proposed fix

Just remove the check for the "opened" flag, if init is called then so will finalize!
Comment 2 vanista 2008-12-03 14:55:01 UTC
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.
Comment 3 Edward Hervey 2008-12-03 17:44:07 UTC
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