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.
This commit is contained in:
Tim-Philipp Müller 2006-09-29 17:17:01 +00:00
parent 8c08c7872b
commit 43d197a833
4 changed files with 22 additions and 13 deletions

View file

@ -1,3 +1,9 @@
2006-09-29 Tim-Philipp Müller <tim at centricular dot net>
* 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 <edward@fluendo.com> 2006-09-23 Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps), * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps),

2
common

@ -1 +1 @@
Subproject commit a8c15b7a2c75fc2bd83850cb17cb05a1ee84ecaf Subproject commit 9991f6fa61ee11475c390dd6675ef7952f079e43

View file

@ -2060,7 +2060,7 @@ gst_ffmpegdec_register (GstPlugin * plugin)
while (in_plugin) { while (in_plugin) {
GstFFMpegDecClassParams *params; GstFFMpegDecClassParams *params;
GstCaps *srccaps, *sinkcaps; GstCaps *srccaps = NULL, *sinkcaps = NULL;
gchar *type_name; gchar *type_name;
/* no quasi-codecs, please */ /* no quasi-codecs, please */
@ -2088,13 +2088,8 @@ gst_ffmpegdec_register (GstPlugin * plugin)
} else { } else {
srccaps = gst_ffmpeg_codectype_to_caps (in_plugin->type, NULL); srccaps = gst_ffmpeg_codectype_to_caps (in_plugin->type, NULL);
} }
if (!sinkcaps || !srccaps) { if (!sinkcaps || !srccaps)
if (sinkcaps)
gst_caps_unref (sinkcaps);
if (srccaps)
gst_caps_unref (srccaps);
goto next; goto next;
}
/* construct the type */ /* construct the type */
type_name = g_strdup_printf ("ffdec_%s", in_plugin->name); 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 = g_new0 (GstFFMpegDecClassParams, 1);
params->in_plugin = in_plugin; params->in_plugin = in_plugin;
params->srccaps = srccaps; params->srccaps = gst_caps_ref (srccaps);
params->sinkcaps = sinkcaps; params->sinkcaps = gst_caps_ref (sinkcaps);
g_hash_table_insert (global_plugins, g_hash_table_insert (global_plugins,
GINT_TO_POINTER (0), (gpointer) params); GINT_TO_POINTER (0), (gpointer) params);
@ -2156,6 +2151,10 @@ gst_ffmpegdec_register (GstPlugin * plugin)
GINT_TO_POINTER (type), (gpointer) params); GINT_TO_POINTER (type), (gpointer) params);
next: next:
if (sinkcaps)
gst_caps_unref (sinkcaps);
if (srccaps)
gst_caps_unref (srccaps);
in_plugin = in_plugin->next; in_plugin = in_plugin->next;
} }
g_hash_table_remove (global_plugins, GINT_TO_POINTER (0)); g_hash_table_remove (global_plugins, GINT_TO_POINTER (0));

View file

@ -910,7 +910,7 @@ gst_ffmpegenc_register (GstPlugin * plugin)
while (in_plugin) { while (in_plugin) {
gchar *type_name; gchar *type_name;
GstCaps *srccaps, *sinkcaps; GstCaps *srccaps = NULL, *sinkcaps = NULL;
GstFFMpegEncClassParams *params; GstFFMpegEncClassParams *params;
/* no quasi codecs, please */ /* no quasi codecs, please */
@ -953,8 +953,8 @@ gst_ffmpegenc_register (GstPlugin * plugin)
params = g_new0 (GstFFMpegEncClassParams, 1); params = g_new0 (GstFFMpegEncClassParams, 1);
params->in_plugin = in_plugin; params->in_plugin = in_plugin;
params->srccaps = srccaps; params->srccaps = gst_caps_ref (srccaps);
params->sinkcaps = sinkcaps; params->sinkcaps = gst_caps_ref (sinkcaps);
g_hash_table_insert (enc_global_plugins, g_hash_table_insert (enc_global_plugins,
GINT_TO_POINTER (0), (gpointer) params); GINT_TO_POINTER (0), (gpointer) params);
@ -972,6 +972,10 @@ gst_ffmpegenc_register (GstPlugin * plugin)
GINT_TO_POINTER (type), (gpointer) params); GINT_TO_POINTER (type), (gpointer) params);
next: next:
if (sinkcaps)
gst_caps_unref (sinkcaps);
if (srccaps)
gst_caps_unref (srccaps);
in_plugin = in_plugin->next; in_plugin = in_plugin->next;
} }
g_hash_table_remove (enc_global_plugins, GINT_TO_POINTER (0)); g_hash_table_remove (enc_global_plugins, GINT_TO_POINTER (0));