From: Mark Nauwelaerts Date: Tue, 28 Jun 2011 17:01:57 +0000 (+0200) Subject: inputselector: avoid iterating over a single NULL pad X-Git-Tag: RELEASE-0.11.0~66 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7a0e401133b1401744862e3cecfe330317cf2ed9;p=platform%2Fupstream%2Fgstreamer.git inputselector: avoid iterating over a single NULL pad --- diff --git a/plugins/elements/gstinputselector.c b/plugins/elements/gstinputselector.c index c1d257b..7235a47 100644 --- a/plugins/elements/gstinputselector.c +++ b/plugins/elements/gstinputselector.c @@ -334,7 +334,7 @@ gst_selector_pad_iterate_linked_pads (GstPad * pad) { GstInputSelector *sel; GstPad *otherpad; - GstIterator *it; + GstIterator *it = NULL; GValue val = { 0, }; sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad)); @@ -342,13 +342,13 @@ gst_selector_pad_iterate_linked_pads (GstPad * pad) return NULL; otherpad = gst_input_selector_get_linked_pad (sel, pad, TRUE); - g_value_init (&val, GST_TYPE_PAD); - g_value_set_object (&val, otherpad); - it = gst_iterator_new_single (GST_TYPE_PAD, &val); - g_value_unset (&val); - - if (otherpad) + if (otherpad) { + g_value_init (&val, GST_TYPE_PAD); + g_value_set_object (&val, otherpad); + it = gst_iterator_new_single (GST_TYPE_PAD, &val); + g_value_unset (&val); gst_object_unref (otherpad); + } gst_object_unref (sel); return it;