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.
This commit is contained in:
benjamin gaignard 2010-12-20 15:33:28 +01:00 committed by Sebastian Dröge
parent 3c2d4a4b0a
commit f0ebcba6c4

View file

@ -576,6 +576,7 @@ gst_auto_convert_add_element (GstAutoConvert * autoconvert,
if (!sinkpad) { if (!sinkpad) {
GST_ERROR_OBJECT (autoconvert, "Could not find sink in %s", GST_ERROR_OBJECT (autoconvert, "Could not find sink in %s",
GST_OBJECT_NAME (element)); GST_OBJECT_NAME (element));
gst_object_unref (srcpad);
goto error; goto error;
} }
@ -652,6 +653,9 @@ gst_auto_convert_add_element (GstAutoConvert * autoconvert,
/* Increment the reference count we will return to the caller */ /* Increment the reference count we will return to the caller */
gst_object_ref (element); gst_object_ref (element);
/* unref sink and src pad */
gst_object_unref (srcpad);
gst_object_unref (sinkpad);
return element; return element;
error: error:
@ -879,6 +883,8 @@ gst_auto_convert_sink_setcaps (GstPad * pad, GstCaps * caps)
/* And make it the current child */ /* And make it the current child */
if (gst_auto_convert_activate_element (autoconvert, element, caps)) if (gst_auto_convert_activate_element (autoconvert, element, caps))
break; break;
else
gst_object_unref (element);
} }
get_out: get_out: