GNOME Bugzilla – Bug 784978
omx: Possible Memory leak in gst_caps_from_string
Last modified: 2017-07-25 08:50:02 UTC
Hello All, There is possible Memory leak in gstomx.c File : gst-omx/omx/gstmox.c In function "_class_init" at line: 2662 here caps are allocated . caps = gst_caps_from_string (template_caps); In function gst_pad_template_new(...) at Line :2636 and 2662 caps must be unref after used. below documentation also suggest : https://sourcecodebrowser.com/gstreamer0.10/0.10.18/gst_2gstcaps_8c.html#a90f2094f46fc946b6850dd606558f81f Solution: There must be gst_caps_unref(caps); after use of caps. Please check and provide your feedback.
This is correct, though, this is just a leak ref, the caps in caps template are never freed, that is normal. Will you provide a patch ? Be aware of the following section, using the same pattern hence leaving the caps to ref 2 instead of ref 1.
Created attachment 355746 [details] [review] Patch is attched Hello All, Please review the attached patch and provide your feedback.
Review of attachment 355746 [details] [review]: ::: omx/gstomx.c @@ +2663,3 @@ g_free (template_caps); gst_element_class_add_pad_template (element_class, templ); + gst_caps_unref (caps); There's the same leak for the sink pad template a few lines above
Created attachment 355750 [details] [review] Patch file is attached.
commit 5e6c3f170f3513dff3eb7384ed211a88c85b51f8 (HEAD -> master) Author: Satya Prakash Gupta <sp.gupta@samsung.com> Date: Mon Jul 17 18:36:36 2017 +0530 omx: Possible Memory leak in gst_caps_from_string https://bugzilla.gnome.org/show_bug.cgi?id=784978