From 7125e227fa6191a5018e712220ee928ec383a6bc Mon Sep 17 00:00:00 2001 From: Eunhae Choi Date: Thu, 29 Jun 2017 20:14:21 +0900 Subject: [PATCH] playback,videoscale: fix caps leak Change-Id: I7b560c0c4ec9de84f9db1e0fee2e8f3b14a70040 --- gst/playback/gstplaybackutils.c | 4 ++++ gst/videoscale/gstvideoscale.c | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/gst/playback/gstplaybackutils.c b/gst/playback/gstplaybackutils.c index d003c91..5555573 100644 --- a/gst/playback/gstplaybackutils.c +++ b/gst/playback/gstplaybackutils.c @@ -81,6 +81,9 @@ gst_playback_utils_get_n_common_capsfeatures (GstElementFactory * fact1, fact1_tmpl_caps = get_template_caps (fact1, GST_PAD_SRC); fact2_tmpl_caps = get_template_caps (fact2, GST_PAD_SINK); if (!fact1_tmpl_caps || !fact2_tmpl_caps) { + if (fact1_tmpl_caps) gst_caps_unref (fact1_tmpl_caps); + if (fact2_tmpl_caps) gst_caps_unref (fact2_tmpl_caps); + GST_ERROR ("Failed to get template caps from decoder or sink"); return 0; } @@ -128,6 +131,7 @@ gst_playback_utils_get_n_common_capsfeatures (GstElementFactory * fact1, gst_caps_unref (fact1_tmpl_caps); gst_caps_unref (fact2_tmpl_caps); + gst_caps_unref (raw_caps); return n_common_cf; } diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c index 871717b..64bee0e 100644 --- a/gst/videoscale/gstvideoscale.c +++ b/gst/videoscale/gstvideoscale.c @@ -166,15 +166,19 @@ gst_video_scale_get_capslist (void) static GstPadTemplate * gst_video_scale_src_template_factory (void) { - return gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - gst_video_scale_get_capslist ()); + GstCaps *tmp = gst_video_scale_get_capslist (); + GstPadTemplate *tmpl = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, tmp); + gst_caps_unref (tmp); + return tmpl; } static GstPadTemplate * gst_video_scale_sink_template_factory (void) { - return gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - gst_video_scale_get_capslist ()); + GstCaps *tmp = gst_video_scale_get_capslist (); + GstPadTemplate *tmpl = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, tmp); + gst_caps_unref (tmp); + return tmpl; } -- 2.7.4