From 2f8f014d9b5c46c9194b8b0f55244882de7ef1c7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 30 Jun 2009 02:15:21 +0100 Subject: [PATCH] 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. --- ext/ffmpeg/gstffmpegmux.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ext/ffmpeg/gstffmpegmux.c b/ext/ffmpeg/gstffmpegmux.c index 4fb7b27..3afdf23 100644 --- a/ext/ffmpeg/gstffmpegmux.c +++ b/ext/ffmpeg/gstffmpegmux.c @@ -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; } -- 2.7.4