GNOME Bugzilla – Bug 772497
waveform : Fix Memory leak by gst_caps_to_string
Last modified: 2016-10-31 14:34:09 UTC
Created attachment 337038 [details] [review] waveform : Fix Memory leak by gst_caps_to_string gst_caps_to_string() returned allocated memory, which must be freed using g_free(). The current patch fixes the memory leak due to call of gst_caps_to_string(). Please review.
Review of attachment 337038 [details] [review]: ::: sys/waveform/gstwaveformsink.c @@ +327,3 @@ GST_CAT_LOG_OBJECT (waveformsink_debug, wfsink, "Returning caps %s", + caps_str); + g_free (caps_str); Use GST_PTR_FORMAT here instead of manually converting to string & freeing
SO, you mean using GST_PTR_FORMAT is better way as it avoid memory allocation also ? So, is it the best way wherever gst_caps_to_string() is used for logging/error reporting purposes?
It does not avoid the allocation, it just avoids additional code. It also only works in the GST_DEBUG (etc) macros. Do > GST_CAT_LOG_OBJECT (......, "bla %" GST_PTR_FORMAT, caps)
Ok, I will send updated patch.
Shaill I change other instances also where gst_caps_to_string() is used for logging/error reporting?
Created attachment 337135 [details] [review] Fix memory leak by gst_caps_to_string() using GST_PTR_FORMAT Use GST_PTR_FORMAT instead of gst_caps_to_string() API for simplicity.
commit 1950b72e2b6a9b4d2dc6799c0694ab1f5b0c1ef6 Author: Gaurav Gupta <g.gupta@samsung.com> Date: Fri Oct 7 13:04:27 2016 +0530 waveformsink: Fix Memory leak using GST_PTR_FORMAT https://bugzilla.gnome.org/show_bug.cgi?id=772497
Review of attachment 337135 [details] [review]: ::: sys/waveform/gstwaveformsink.c @@ +323,3 @@ } + GST_CAT_LOG_OBJECT (waveformsink_debug, wfsink, "Returning caps %s" GST_PTR_FORMAT, caps); That's not how this works, but I fixed that up before merging. It's "... %" GST_PTR_FORMAT, caps) without the s
*** Bug 773306 has been marked as a duplicate of this bug. ***