From 701e54cecfce85c2e2bdb3ae96b142c76400ed44 Mon Sep 17 00:00:00 2001 From: Jimmy Ohn Date: Thu, 6 Oct 2016 15:54:00 +0900 Subject: [PATCH] opencv: Fix memory leak by gst_caps_to_string gst_caps_to_string function returned allocated memory. So, It should be freed using g_free function. https://bugzilla.gnome.org/show_bug.cgi?id=772499 --- ext/opencv/gstopencvutils.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/opencv/gstopencvutils.cpp b/ext/opencv/gstopencvutils.cpp index 57b660dd36..640486be19 100644 --- a/ext/opencv/gstopencvutils.cpp +++ b/ext/opencv/gstopencvutils.cpp @@ -34,6 +34,7 @@ gst_opencv_parse_iplimage_params_from_caps (GstCaps * caps, gint * width, GstVideoInfo info; gint depth = 0; guint i; + gchar *caps_str; if (!gst_video_info_from_caps (&info, caps)) { GST_ERROR ("Failed to get the videoinfo from caps"); @@ -49,8 +50,10 @@ gst_opencv_parse_iplimage_params_from_caps (GstCaps * caps, gint * width, else if (GST_VIDEO_INFO_IS_GRAY (&info)) *channels = 1; else { + caps_str = gst_caps_to_string (caps); g_set_error (err, GST_CORE_ERROR, GST_CORE_ERROR_NEGOTIATION, - "Unsupported caps %s", gst_caps_to_string (caps)); + "Unsupported caps %s", caps_str); + g_free (caps_str); return FALSE; }