ximagsink: do not access uninitialized height variable.

Exit like in xvimagesink, if we have partial caps.
This commit is contained in:
Stefan Kost 2009-02-06 11:10:15 +02:00
parent ea2e208cc1
commit bc4388c413

View file

@ -1659,6 +1659,7 @@ gst_ximagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
GstCaps *alloc_caps;
gboolean alloc_unref = FALSE;
gint width, height;
GstVideoRectangle dst, src, result;
ximagesink = GST_XIMAGESINK (bsink);
@ -1674,10 +1675,13 @@ gst_ximagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
/* get struct to see what is requested */
structure = gst_caps_get_structure (caps, 0);
if (gst_structure_get_int (structure, "width", &width) &&
gst_structure_get_int (structure, "height", &height)) {
GstVideoRectangle dst, src, result;
if (!gst_structure_get_int (structure, "width", &width) ||
!gst_structure_get_int (structure, "height", &height)) {
GST_WARNING_OBJECT (ximagesink, "invalid caps for buffer allocation %"
GST_PTR_FORMAT, caps);
ret = GST_FLOW_UNEXPECTED;
goto beach;
}
src.w = width;
src.h = height;
@ -1757,7 +1761,6 @@ gst_ximagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
* width and height variables */
}
}
}
alloc:
/* Inspect our buffer pool */
@ -1799,6 +1802,7 @@ alloc:
*buf = GST_BUFFER_CAST (ximage);
beach:
return ret;
}