basetransform: Fix refcount leak

Don't leak peercaps and a ref to the basetransform when returning
the cached caps.
This commit is contained in:
Jan Schmidt 2011-10-27 23:08:14 +11:00
parent 03797b9a12
commit 9a5109b86e

View file

@ -722,8 +722,7 @@ gst_base_transform_getcaps (GstPad * pad)
} }
} else { } else {
caps = gst_caps_ref (trans->priv->cached_transformed_caps[cache_index]); caps = gst_caps_ref (trans->priv->cached_transformed_caps[cache_index]);
GST_OBJECT_UNLOCK (trans); goto done;
return caps;
} }
GST_OBJECT_UNLOCK (trans); GST_OBJECT_UNLOCK (trans);
@ -747,7 +746,7 @@ gst_base_transform_getcaps (GstPad * pad)
GST_DEBUG_OBJECT (pad, "transformed %" GST_PTR_FORMAT, caps); GST_DEBUG_OBJECT (pad, "transformed %" GST_PTR_FORMAT, caps);
gst_caps_unref (temp); gst_caps_unref (temp);
if (caps == NULL) if (caps == NULL)
goto done; goto done_update_cache;
/* and filter against the template of this pad */ /* and filter against the template of this pad */
templ = gst_pad_get_pad_template_caps (pad); templ = gst_pad_get_pad_template_caps (pad);
@ -769,7 +768,7 @@ gst_base_transform_getcaps (GstPad * pad)
} }
} }
done: done_update_cache:
GST_DEBUG_OBJECT (trans, "returning %" GST_PTR_FORMAT, caps); GST_DEBUG_OBJECT (trans, "returning %" GST_PTR_FORMAT, caps);
GST_OBJECT_LOCK (trans); GST_OBJECT_LOCK (trans);
@ -779,6 +778,8 @@ done:
if (caps) { if (caps) {
trans->priv->cached_transformed_caps[cache_index] = gst_caps_ref (caps); trans->priv->cached_transformed_caps[cache_index] = gst_caps_ref (caps);
} }
done:
GST_OBJECT_UNLOCK (trans); GST_OBJECT_UNLOCK (trans);
if (peercaps) if (peercaps)