GNOME Bugzilla – Bug 730133
motioncells:fix memleak
Last modified: 2014-05-14 23:34:18 UTC
Created attachment 276536 [details] [review] fix memleak please see the attached patch
Created attachment 276537 [details] [review] fix memleak previous patch break alpha blending
Created attachment 276548 [details] [review] improved patch
Review of attachment 276548 [details] [review]: Just a minor improvement below. ::: ext/opencv/gstmotioncells.c @@ +864,3 @@ GST_OBJECT_LOCK (filter); + if (!gst_buffer_is_writable (buf)) + buf = gst_buffer_make_writable (buf); You are making the buffer writable even when the 'calculate_motion' is set to false. It would be better to only do it if the buffer is actually going to be used.
And please don't do if (!is_writable) make_writable, just call make_writable() unconditionally - it will return the input buffer if the buffer is already writable.
Created attachment 276556 [details] [review] fix memleak the patch seems big now but I simply replaced: gst_buffer_map (buf, &info, GST_MAP_WRITE) with if (gst_buffer_map (buf, &info, GST_MAP_WRITE)) { ... } and added the else cause, other then this the only change are the two gst_buffer_unmap needed to avoid the memleaks
Thanks for the patch commit bd34e628722c8916b023e776677b272df8d77eac Author: Nicola Murino <nicola.murino@gmail.com> Date: Wed May 14 21:32:10 2014 +0200 motioncells: fix memleak Check gst_buffer_map return and remember to unmap and free memory before returning https://bugzilla.gnome.org/show_bug.cgi?id=730133