From 43d197a8331363212bb6c2893cdc49074bb6dd25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 29 Sep 2006 17:17:01 +0000 Subject: [PATCH] ext/ffmpeg/: Don't leak caps in some cases and make build bots happy again. Original commit message from CVS: * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_register): * ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_register): Don't leak caps in some cases and make build bots happy again. --- ChangeLog | 6 ++++++ common | 2 +- ext/ffmpeg/gstffmpegdec.c | 17 ++++++++--------- ext/ffmpeg/gstffmpegenc.c | 10 +++++++--- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 716dcdfbb8..33e6664caa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-09-29 Tim-Philipp Müller + + * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_register): + * ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_register): + Don't leak caps in some cases and make build bots happy again. + 2006-09-23 Edward Hervey * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps), diff --git a/common b/common index a8c15b7a2c..9991f6fa61 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit a8c15b7a2c75fc2bd83850cb17cb05a1ee84ecaf +Subproject commit 9991f6fa61ee11475c390dd6675ef7952f079e43 diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c index 19dc92cd92..410213259f 100644 --- a/ext/ffmpeg/gstffmpegdec.c +++ b/ext/ffmpeg/gstffmpegdec.c @@ -2060,7 +2060,7 @@ gst_ffmpegdec_register (GstPlugin * plugin) while (in_plugin) { GstFFMpegDecClassParams *params; - GstCaps *srccaps, *sinkcaps; + GstCaps *srccaps = NULL, *sinkcaps = NULL; gchar *type_name; /* no quasi-codecs, please */ @@ -2088,13 +2088,8 @@ gst_ffmpegdec_register (GstPlugin * plugin) } else { srccaps = gst_ffmpeg_codectype_to_caps (in_plugin->type, NULL); } - if (!sinkcaps || !srccaps) { - if (sinkcaps) - gst_caps_unref (sinkcaps); - if (srccaps) - gst_caps_unref (srccaps); + if (!sinkcaps || !srccaps) goto next; - } /* construct the type */ type_name = g_strdup_printf ("ffdec_%s", in_plugin->name); @@ -2107,8 +2102,8 @@ gst_ffmpegdec_register (GstPlugin * plugin) params = g_new0 (GstFFMpegDecClassParams, 1); params->in_plugin = in_plugin; - params->srccaps = srccaps; - params->sinkcaps = sinkcaps; + params->srccaps = gst_caps_ref (srccaps); + params->sinkcaps = gst_caps_ref (sinkcaps); g_hash_table_insert (global_plugins, GINT_TO_POINTER (0), (gpointer) params); @@ -2156,6 +2151,10 @@ gst_ffmpegdec_register (GstPlugin * plugin) GINT_TO_POINTER (type), (gpointer) params); next: + if (sinkcaps) + gst_caps_unref (sinkcaps); + if (srccaps) + gst_caps_unref (srccaps); in_plugin = in_plugin->next; } g_hash_table_remove (global_plugins, GINT_TO_POINTER (0)); diff --git a/ext/ffmpeg/gstffmpegenc.c b/ext/ffmpeg/gstffmpegenc.c index e0eba05c5b..bf03b362ae 100644 --- a/ext/ffmpeg/gstffmpegenc.c +++ b/ext/ffmpeg/gstffmpegenc.c @@ -910,7 +910,7 @@ gst_ffmpegenc_register (GstPlugin * plugin) while (in_plugin) { gchar *type_name; - GstCaps *srccaps, *sinkcaps; + GstCaps *srccaps = NULL, *sinkcaps = NULL; GstFFMpegEncClassParams *params; /* no quasi codecs, please */ @@ -953,8 +953,8 @@ gst_ffmpegenc_register (GstPlugin * plugin) params = g_new0 (GstFFMpegEncClassParams, 1); params->in_plugin = in_plugin; - params->srccaps = srccaps; - params->sinkcaps = sinkcaps; + params->srccaps = gst_caps_ref (srccaps); + params->sinkcaps = gst_caps_ref (sinkcaps); g_hash_table_insert (enc_global_plugins, GINT_TO_POINTER (0), (gpointer) params); @@ -972,6 +972,10 @@ gst_ffmpegenc_register (GstPlugin * plugin) GINT_TO_POINTER (type), (gpointer) params); next: + if (sinkcaps) + gst_caps_unref (sinkcaps); + if (srccaps) + gst_caps_unref (srccaps); in_plugin = in_plugin->next; } g_hash_table_remove (enc_global_plugins, GINT_TO_POINTER (0));