utils: Ghostpads can be request pads too but check if the pad has a template

Otherwise we dereference NULL in some cases and crash.
This commit is contained in:
Sebastian Dröge 2014-08-06 14:43:08 +02:00
parent 4cf6a6e086
commit 27d1901d19

View file

@ -1674,8 +1674,8 @@ gst_element_link_pads_full (GstElement * src, const gchar * srcpadname,
gst_object_ref (temp); gst_object_ref (temp);
} else { } else {
temp = gst_element_get_compatible_pad (dest, srcpad, NULL); temp = gst_element_get_compatible_pad (dest, srcpad, NULL);
if (!GST_IS_GHOST_PAD (temp) && if (temp && GST_PAD_PAD_TEMPLATE (temp)
GST_PAD_TEMPLATE_PRESENCE (GST_PAD_PAD_TEMPLATE (temp)) == && GST_PAD_TEMPLATE_PRESENCE (GST_PAD_PAD_TEMPLATE (temp)) ==
GST_PAD_REQUEST) { GST_PAD_REQUEST) {
temprequest = TRUE; temprequest = TRUE;
} }
@ -1732,13 +1732,11 @@ gst_element_link_pads_full (GstElement * src, const gchar * srcpadname,
GstPad *temp = gst_element_get_compatible_pad (src, destpad, NULL); GstPad *temp = gst_element_get_compatible_pad (src, destpad, NULL);
gboolean temprequest = FALSE; gboolean temprequest = FALSE;
if (temp) { if (temp && GST_PAD_PAD_TEMPLATE (temp)
if (!GST_IS_GHOST_PAD (temp) && && GST_PAD_TEMPLATE_PRESENCE (GST_PAD_PAD_TEMPLATE (temp)) ==
GST_PAD_TEMPLATE_PRESENCE (GST_PAD_PAD_TEMPLATE (temp)) ==
GST_PAD_REQUEST) { GST_PAD_REQUEST) {
temprequest = TRUE; temprequest = TRUE;
} }
}
if (temp && pad_link_maybe_ghosting (temp, destpad, flags)) { if (temp && pad_link_maybe_ghosting (temp, destpad, flags)) {
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "linked pad %s:%s to pad %s:%s", GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "linked pad %s:%s to pad %s:%s",