gst/playback/: Fix memleaks (#157233).

Original commit message from CVS:
Reviewed by:  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
* gst/playback/gstdecodebin.c: (new_pad), (close_link):
* gst/playback/gstplaybasebin.c: (new_decoded_pad):
Fix memleaks (#157233).
This commit is contained in:
Ronald S. Bultje 2004-12-16 11:54:53 +00:00
parent 5ab122366b
commit 810bc9fc7e
3 changed files with 21 additions and 2 deletions

View file

@ -1,3 +1,11 @@
2004-12-16 Christophe Fergeau <teuf@gnome.org>
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst/playback/gstdecodebin.c: (new_pad), (close_link):
* gst/playback/gstplaybasebin.c: (new_decoded_pad):
Fix memleaks (#157233).
2004-12-16 Sebastien Cote <sc5@hermes.usherb.ca> 2004-12-16 Sebastien Cote <sc5@hermes.usherb.ca>
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net> Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>

View file

@ -637,11 +637,15 @@ static void
new_pad (GstElement * element, GstPad * pad, GstDynamic * dynamic) new_pad (GstElement * element, GstPad * pad, GstDynamic * dynamic)
{ {
GstDecodeBin *decode_bin = dynamic->decode_bin; GstDecodeBin *decode_bin = dynamic->decode_bin;
GstCaps *caps;
/* see if any more pending dynamic connections exist */ /* see if any more pending dynamic connections exist */
gboolean more = gst_decode_bin_is_dynamic (decode_bin); gboolean more = gst_decode_bin_is_dynamic (decode_bin);
close_pad_link (element, pad, gst_pad_get_caps (pad), decode_bin, more); caps = gst_pad_get_caps (pad);
close_pad_link (element, pad, caps, decode_bin, more);
if (caps)
gst_caps_free (caps);
} }
/* this signal is fired when an element signals the no_more_pads signal. /* this signal is fired when an element signals the no_more_pads signal.
@ -813,6 +817,7 @@ close_link (GstElement * element, GstDecodeBin * decode_bin)
/* now loop over all the pads we need to connect */ /* now loop over all the pads we need to connect */
for (pads = to_connect; pads; pads = g_list_next (pads)) { for (pads = to_connect; pads; pads = g_list_next (pads)) {
GstPad *pad = GST_PAD (pads->data); GstPad *pad = GST_PAD (pads->data);
GstCaps *caps;
/* we have more pads if we have more than 1 pad to connect or /* we have more pads if we have more than 1 pad to connect or
* dynamics. If we have only 1 pad and no dynamics, more will be * dynamics. If we have only 1 pad and no dynamics, more will be
@ -824,7 +829,10 @@ close_link (GstElement * element, GstDecodeBin * decode_bin)
gst_pad_get_name (pad)); gst_pad_get_name (pad));
/* continue autoplugging on the pads */ /* continue autoplugging on the pads */
close_pad_link (element, pad, gst_pad_get_caps (pad), decode_bin, more); caps = gst_pad_get_caps (pad);
close_pad_link (element, pad, caps, decode_bin, more);
if (caps)
gst_caps_free (caps);
} }
g_list_free (to_connect); g_list_free (to_connect);

View file

@ -657,6 +657,8 @@ new_decoded_pad (GstElement * element, GstPad * pad, gboolean last,
caps = gst_pad_get_caps (pad); caps = gst_pad_get_caps (pad);
if (caps == NULL || gst_caps_is_empty (caps)) { if (caps == NULL || gst_caps_is_empty (caps)) {
g_warning ("no type on pad %s:%s", GST_DEBUG_PAD_NAME (pad)); g_warning ("no type on pad %s:%s", GST_DEBUG_PAD_NAME (pad));
if (caps)
gst_caps_free (caps);
return; return;
} }
@ -717,6 +719,7 @@ new_decoded_pad (GstElement * element, GstPad * pad, gboolean last,
} }
/* add the stream to the list */ /* add the stream to the list */
info = gst_stream_info_new (GST_OBJECT (srcpad), type, NULL, caps); info = gst_stream_info_new (GST_OBJECT (srcpad), type, NULL, caps);
gst_caps_free (caps);
info->origin = GST_OBJECT (pad); info->origin = GST_OBJECT (pad);
add_stream (group, info); add_stream (group, info);