GNOME Bugzilla – Bug 564885
[mpegstream] memory leak
Last modified: 2009-01-08 08:18:46 UTC
Using valgrind I found some memory caps leak when using dvddemux (missing unref of caps). I made patch for my older version of gst-plugins-ugly and port the fix to the HEAD of cvs too. It compile ok but my setup doesn't allow me to test easily on the latest version (however, it is really some missing unref, so nothing complicated)
Created attachment 124874 [details] [review] patch for this bug
The last part of the patch is obviously correct but I'm not sure the others are. str->caps should probably contain the caps of the pad, even after they're set. The memory leak is more caused by the fact, that str->caps gets new caps when something changes without having the old caps unref'd first. Could you update the patch to unref str->caps before storing new caps there?
Created attachment 125955 [details] [review] update of the previous patch you where right, the first part was not correct at all. Here is an update of the patch. It could be possibly simplified by using gst_caps_replace instead of my if/unref in part of the code where a new caps override an existing one. However, I play safe since I don't know this code a lot and doing gst_caps_replace over a null pointer is not good!
2009-01-08 Sebastian Dröge <sebastian.droege@collabora.co.uk> Patch by: Yves Lefebvre <ivanohe at abacom dot com> * gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_get_video_stream), (gst_dvd_demux_get_audio_stream), (gst_dvd_demux_get_subpicture_stream), (gst_dvd_demux_reset): * gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_init_stream), (gst_mpeg_demux_get_video_stream), (gst_mpeg_demux_get_audio_stream), (gst_mpeg_demux_reset): * gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_chain): Fix some caps leaks. Fixes bug #564885.