From: Tim-Philipp Müller Date: Mon, 23 May 2016 17:00:30 +0000 (+0100) Subject: iterator: only unset GValue if it was inited X-Git-Tag: 1.10.4~243 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e0de5ed915f779eaefac7267a54f3aa49837a0bc;p=platform%2Fupstream%2Fgstreamer.git iterator: only unset GValue if it was inited And add some function guards. From GLib 2.48 on it is allowed to pass an uninitialised GValue to g_value_unset(). https://bugzilla.gnome.org/show_bug.cgi?id=763762 --- diff --git a/gst/gstiterator.c b/gst/gstiterator.c index 77f0c02..b15b202 100644 --- a/gst/gstiterator.c +++ b/gst/gstiterator.c @@ -607,6 +607,8 @@ gst_iterator_fold (GstIterator * it, GstIteratorFoldFunction func, GValue item = { 0, }; GstIteratorResult result; + g_return_val_if_fail (it != NULL, GST_ITERATOR_ERROR); + while (1) { result = gst_iterator_next (it, &item); switch (result) { @@ -625,7 +627,13 @@ gst_iterator_fold (GstIterator * it, GstIteratorFoldFunction func, } fold_done: + +#if GLIB_CHECK_VERSION (2, 48, 0) g_value_unset (&item); +#else + if (item.g_type != 0) + g_value_unset (&item); +#endif return result; }