From: Sebastian Dröge Date: Sun, 13 Jun 2010 14:27:39 +0000 (+0200) Subject: pad: Fix iterator aggregation of all pads in the internal links fallback X-Git-Tag: RELEASE-0.10.30~121 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6ff314c75a4466536c39b143c156baa64011f516;p=platform%2Fupstream%2Fgstreamer.git pad: Fix iterator aggregation of all pads in the internal links fallback g_list_prepend() returns the new head of the list and not using this will create a memory leak and a single-element list. --- diff --git a/gst/gstpad.c b/gst/gstpad.c index 6df6a7f..90c8577 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -3266,9 +3266,9 @@ gst_pad_iterate_internal_links (GstPad * pad) #ifndef GST_REMOVE_DEPRECATED static void -add_unref_pad_to_list (GstPad * pad, GList * list) +add_unref_pad_to_list (GstPad * pad, GList ** list) { - list = g_list_prepend (list, pad); + *list = g_list_prepend (*list, pad); gst_object_unref (pad); } #endif @@ -3318,7 +3318,7 @@ gst_pad_get_internal_links_default (GstPad * pad) /* loop over the iterator and put all elements into a list, we also * immediatly unref them, which is bad. */ do { - ires = gst_iterator_foreach (it, (GFunc) add_unref_pad_to_list, res); + ires = gst_iterator_foreach (it, (GFunc) add_unref_pad_to_list, &res); switch (ires) { case GST_ITERATOR_OK: case GST_ITERATOR_DONE: