We were returning in various places without unreffing the caps, and
we were also leaking (overwriting) the caps we got from _get_current_caps()
Spotted by Haakon Sporsheim in #gstreamer
caps = gst_pad_get_current_caps (dec->srcpad);
if (caps && !gst_audio_info_from_caps (&dec->priv->ctx.info, caps))
- return FALSE;
+ goto caps_error;
+ if (caps)
+ gst_caps_unref (caps);
caps = gst_pad_get_allowed_caps (dec->srcpad);
if (!caps || gst_caps_is_empty (caps) || gst_caps_is_any (caps))
- return FALSE;
+ goto caps_error;
/* before fixating, try to use whatever upstream provided */
caps_size = gst_caps_get_size (caps);
}
if (!caps || !gst_audio_info_from_caps (&dec->priv->ctx.info, caps))
- return FALSE;
+ goto caps_error;
GST_INFO_OBJECT (dec,
"Chose default caps %" GST_PTR_FORMAT " for initial gap", caps);
}
return TRUE;
+
+caps_error:
+ {
+ if (caps)
+ gst_caps_unref (caps);
+ return FALSE;
+ }
}
static gboolean