diff --git a/gst/gstelement.c b/gst/gstelement.c index bba7a264a2..2abd1f0c3e 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -905,13 +905,14 @@ gst_element_real_destroy (GtkObject *object) GST_DEBUG_ELEMENT (GST_CAT_REFCOUNTING, element, "destroy\n"); if (element->pads) { - pads = g_list_copy (element->pads); + GList *orig; + orig = pads = g_list_copy (element->pads); while (pads) { pad = GST_PAD (pads->data); gst_object_unparent (GST_OBJECT (pad)); pads = g_list_next (pads); } - g_list_free (pads); + g_list_free (orig); } g_list_free (element->pads);