changeset 28198:1c58b9d2429b

Unleak pad if more pads are linked.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Fri, 07 Aug 2009 09:25:33 +0000
parents 5058cdd46464
children c1687897825f
files libpurple/mediamanager.c
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/mediamanager.c	Fri Aug 07 08:36:12 2009 +0000
+++ b/libpurple/mediamanager.c	Fri Aug 07 09:25:33 2009 +0000
@@ -399,15 +399,19 @@
 	GstElement *parent = GST_ELEMENT_PARENT(pad);
 	GstIterator *iter;
 	GstPad *remaining_pad;
+	GstIteratorResult result;
 
 	gst_element_release_request_pad(GST_ELEMENT_PARENT(pad), pad);
-	iter = gst_element_iterate_pads(parent);
+	iter = gst_element_iterate_src_pads(parent);
 
-	if (gst_iterator_next(iter, (gpointer)&remaining_pad)
-			== GST_ITERATOR_DONE) {
+	result = gst_iterator_next(iter, (gpointer)&remaining_pad);
+
+	if (result == GST_ITERATOR_DONE) {
 		gst_element_set_locked_state(parent, TRUE);
 		gst_element_set_state(parent, GST_STATE_NULL);
 		gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(parent)), parent);
+	} else if (result == GST_ITERATOR_OK) {
+		gst_object_unref(remaining_pad);
 	}
 
 	gst_iterator_free(iter);