Index: gst/gstbin.c
===================================================================
RCS file: /cvs/gstreamer/gstreamer/gst/gstbin.c,v
retrieving revision 1.384
diff -u -p -r1.384 gstbin.c
--- gst/gstbin.c	25 Aug 2008 11:00:13 -0000	1.384
+++ gst/gstbin.c	28 Aug 2008 12:04:54 -0000
@@ -851,14 +851,32 @@ static void
 unlink_pads (GstPad * pad)
 {
   GstPad *peer;
+  GstPadTemplate *tmpl;
+  GstElement *parent;
 
   if ((peer = gst_pad_get_peer (pad))) {
+
     if (gst_pad_get_direction (pad) == GST_PAD_SRC)
       gst_pad_unlink (pad, peer);
     else
       gst_pad_unlink (peer, pad);
+
+    tmpl = gst_pad_get_pad_template (peer);
+    if (tmpl && (GST_PAD_TEMPLATE_PRESENCE (tmpl) == GST_PAD_REQUEST)) {
+      GST_INFO("release peer request pad");
+      parent = gst_pad_get_parent_element (peer);
+      gst_element_release_request_pad (parent, peer);
+      gst_object_unref (parent);
+    }
     gst_object_unref (peer);
   }
+  tmpl = gst_pad_get_pad_template (pad);
+  if (tmpl && (GST_PAD_TEMPLATE_PRESENCE (tmpl) == GST_PAD_REQUEST)) {
+    GST_INFO("release request pad");
+    parent = gst_pad_get_parent_element (pad);
+    gst_element_release_request_pad (parent, pad);
+    gst_object_unref (parent);
+  }
   gst_object_unref (pad);
 }
 
