liveadder: Fix memory leaks iterating over pads

Rebased for latest master by Nicolas Huet <nicolas.huet@parrot.com>.

https://bugzilla.gnome.org/show_bug.cgi?id=745748
This commit is contained in:
Santiago Carot-Nemesio 2015-06-09 16:33:39 +02:00 committed by Sebastian Dröge
parent 5db08a8b89
commit 9fb4d5df20

View file

@ -604,19 +604,15 @@ static gboolean
gst_live_adder_query_pos_dur (GstLiveAdder * adder, GstFormat format, gst_live_adder_query_pos_dur (GstLiveAdder * adder, GstFormat format,
gboolean position, gint64 * outvalue) gboolean position, gint64 * outvalue)
{ {
GValue item = { 0 };
gint64 max = G_MININT64; gint64 max = G_MININT64;
gboolean res = TRUE; gboolean res = TRUE;
GstIterator *it; GstIterator *it;
gboolean done = FALSE; gboolean done = FALSE;
it = gst_element_iterate_sink_pads (GST_ELEMENT_CAST (adder)); it = gst_element_iterate_sink_pads (GST_ELEMENT_CAST (adder));
while (!done) { while (!done) {
GstIteratorResult ires; switch (gst_iterator_next (it, &item)) {
GValue item = { 0 };
ires = gst_iterator_next (it, &item);
switch (ires) {
case GST_ITERATOR_DONE: case GST_ITERATOR_DONE:
done = TRUE; done = TRUE;
break; break;
@ -647,6 +643,7 @@ gst_live_adder_query_pos_dur (GstLiveAdder * adder, GstFormat format,
max = value; max = value;
} }
} }
g_value_reset (&item);
break; break;
} }
case GST_ITERATOR_RESYNC: case GST_ITERATOR_RESYNC:
@ -659,6 +656,8 @@ gst_live_adder_query_pos_dur (GstLiveAdder * adder, GstFormat format,
break; break;
} }
} }
g_value_unset (&item);
gst_iterator_free (it); gst_iterator_free (it);
if (res) if (res)