ffmpegmux: don't leak caps if type already exists

We don't know if gst_element_register() will replace the known type
or reject it, so we really need to free the caps before.
This commit is contained in:
Tim-Philipp Müller 2009-06-30 02:15:21 +01:00
parent 048b0145a8
commit 2f8f014d9b

View file

@ -861,16 +861,17 @@ gst_ffmpegmux_register (GstPlugin * plugin)
type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &typeinfo, 0);
g_type_set_qdata (type, GST_FFMUX_PARAMS_QDATA, (gpointer) params);
g_type_add_interface_static (type, GST_TYPE_TAG_SETTER, &tag_setter_info);
} else {
gst_caps_replace (&srccaps, NULL);
gst_caps_replace (&audiosinkcaps, NULL);
gst_caps_replace (&videosinkcaps, NULL);
}
if (!gst_element_register (plugin, type_name, GST_RANK_NONE, type)) {
g_free (type_name);
gst_caps_unref (srccaps);
if (audiosinkcaps)
gst_caps_unref (audiosinkcaps);
if (videosinkcaps)
gst_caps_unref (videosinkcaps);
gst_caps_replace (&srccaps, NULL);
gst_caps_replace (&audiosinkcaps, NULL);
gst_caps_replace (&videosinkcaps, NULL);
return FALSE;
}