Index: gst/playback/gstdecodebin2.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstdecodebin2.c,v
retrieving revision 1.21
diff -u -p -u -p -r1.21 gstdecodebin2.c
--- gst/playback/gstdecodebin2.c	10 Sep 2007 12:05:34 -0000	1.21
+++ gst/playback/gstdecodebin2.c	10 Sep 2007 12:42:07 -0000
@@ -1954,6 +1954,16 @@ gst_decode_group_free (GstDecodeGroup * 
   GST_LOG ("group %p", group);
 
   GROUP_MUTEX_LOCK (group);
+
+  /* free ghost pads */
+  if (group == group->dbin->activegroup) {
+    for (tmp = group->ghosts; tmp; tmp = g_list_next (tmp))
+      gst_element_remove_pad (GST_ELEMENT (group->dbin), (GstPad *) tmp->data);
+  
+    g_list_free (group->ghosts);
+    group->ghosts = NULL;
+  }
+
   /* Clear all GstDecodePad */
   for (tmp = group->endpads; tmp; tmp = g_list_next (tmp)) {
     GstDecodePad *dpad = (GstDecodePad *) tmp->data;
