From f0ebcba6c4ce8a6a04a3b041abbd34610c0dc8e7 Mon Sep 17 00:00:00 2001 From: benjamin gaignard Date: Mon, 20 Dec 2010 15:33:28 +0100 Subject: [PATCH] autoconvert: Avoid some leaks in autoconvert unref sink and src pad after gst_pad_by_direction calls unref element if gst_auto_convert_activate_element failed. See bug #637553. --- gst/autoconvert/gstautoconvert.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gst/autoconvert/gstautoconvert.c b/gst/autoconvert/gstautoconvert.c index ebe297c..97bd8b4 100644 --- a/gst/autoconvert/gstautoconvert.c +++ b/gst/autoconvert/gstautoconvert.c @@ -576,6 +576,7 @@ gst_auto_convert_add_element (GstAutoConvert * autoconvert, if (!sinkpad) { GST_ERROR_OBJECT (autoconvert, "Could not find sink in %s", GST_OBJECT_NAME (element)); + gst_object_unref (srcpad); goto error; } @@ -652,6 +653,9 @@ gst_auto_convert_add_element (GstAutoConvert * autoconvert, /* Increment the reference count we will return to the caller */ gst_object_ref (element); + /* unref sink and src pad */ + gst_object_unref (srcpad); + gst_object_unref (sinkpad); return element; error: @@ -879,6 +883,8 @@ gst_auto_convert_sink_setcaps (GstPad * pad, GstCaps * caps) /* And make it the current child */ if (gst_auto_convert_activate_element (autoconvert, element, caps)) break; + else + gst_object_unref (element); } get_out: -- 2.7.4