mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
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:
parent
048b0145a8
commit
2f8f014d9b
1 changed files with 7 additions and 6 deletions
|
@ -861,16 +861,17 @@ gst_ffmpegmux_register (GstPlugin * plugin)
|
||||||
type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &typeinfo, 0);
|
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_set_qdata (type, GST_FFMUX_PARAMS_QDATA, (gpointer) params);
|
||||||
g_type_add_interface_static (type, GST_TYPE_TAG_SETTER, &tag_setter_info);
|
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)) {
|
if (!gst_element_register (plugin, type_name, GST_RANK_NONE, type)) {
|
||||||
g_free (type_name);
|
g_free (type_name);
|
||||||
gst_caps_unref (srccaps);
|
gst_caps_replace (&srccaps, NULL);
|
||||||
if (audiosinkcaps)
|
gst_caps_replace (&audiosinkcaps, NULL);
|
||||||
gst_caps_unref (audiosinkcaps);
|
gst_caps_replace (&videosinkcaps, NULL);
|
||||||
if (videosinkcaps)
|
|
||||||
gst_caps_unref (videosinkcaps);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue