diff --git a/ChangeLog b/ChangeLog index a5a0980c63..5ce0c007d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-12-16 Christophe Fergeau + + Reviewed by: Ronald S. Bultje + + * gst/playback/gstdecodebin.c: (new_pad), (close_link): + * gst/playback/gstplaybasebin.c: (new_decoded_pad): + Fix memleaks (#157233). + 2004-12-16 Sebastien Cote Reviewed by: Ronald S. Bultje diff --git a/gst/playback/gstdecodebin.c b/gst/playback/gstdecodebin.c index f9a3ba57eb..4b8f224a80 100644 --- a/gst/playback/gstdecodebin.c +++ b/gst/playback/gstdecodebin.c @@ -637,11 +637,15 @@ static void new_pad (GstElement * element, GstPad * pad, GstDynamic * dynamic) { GstDecodeBin *decode_bin = dynamic->decode_bin; + GstCaps *caps; /* see if any more pending dynamic connections exist */ 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. @@ -813,6 +817,7 @@ close_link (GstElement * element, GstDecodeBin * decode_bin) /* now loop over all the pads we need to connect */ for (pads = to_connect; pads; pads = g_list_next (pads)) { GstPad *pad = GST_PAD (pads->data); + GstCaps *caps; /* 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 @@ -824,7 +829,10 @@ close_link (GstElement * element, GstDecodeBin * decode_bin) gst_pad_get_name (pad)); /* 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); diff --git a/gst/playback/gstplaybasebin.c b/gst/playback/gstplaybasebin.c index f22f1b287e..c412eb5ed5 100644 --- a/gst/playback/gstplaybasebin.c +++ b/gst/playback/gstplaybasebin.c @@ -657,6 +657,8 @@ new_decoded_pad (GstElement * element, GstPad * pad, gboolean last, caps = gst_pad_get_caps (pad); if (caps == NULL || gst_caps_is_empty (caps)) { g_warning ("no type on pad %s:%s", GST_DEBUG_PAD_NAME (pad)); + if (caps) + gst_caps_free (caps); return; } @@ -717,6 +719,7 @@ new_decoded_pad (GstElement * element, GstPad * pad, gboolean last, } /* add the stream to the list */ info = gst_stream_info_new (GST_OBJECT (srcpad), type, NULL, caps); + gst_caps_free (caps); info->origin = GST_OBJECT (pad); add_stream (group, info);