element: Add guard to gst_element_release_pad() to ensure the pad belongs to this...
authorSebastian Dröge <sebastian@centricular.com>
Thu, 22 Dec 2016 10:05:56 +0000 (12:05 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 22 Dec 2016 10:08:14 +0000 (12:08 +0200)
It's a programming error to pass other pads here, and it easily causes
crashes or other problematic behaviour down the road as subclasses
usually assume to only get their pads.

gst/gstelement.c

index 4ff9c67..a7aa591 100644 (file)
@@ -345,6 +345,7 @@ gst_element_release_request_pad (GstElement * element, GstPad * pad)
   g_return_if_fail (GST_PAD_PAD_TEMPLATE (pad) == NULL ||
       GST_PAD_TEMPLATE_PRESENCE (GST_PAD_PAD_TEMPLATE (pad)) ==
       GST_PAD_REQUEST);
+  g_return_if_fail (GST_PAD_PARENT (pad) == element);
 
   oclass = GST_ELEMENT_GET_CLASS (element);