Bail out from cursor creation when malloc fails.

This commit is contained in:
Laszlo Agocs 2011-06-09 11:05:56 +02:00
parent 06c56cb464
commit d88a773218

View File

@ -226,6 +226,12 @@ xcb_cursor_t qt_xcb_createCursorXRender(QXcbScreen *screen, const QImage &image,
return XCB_NONE;
}
xi->data = (uint8_t *) malloc(xi->stride * h);
if (!xi->data) {
qWarning("createCursorXRender: Failed to malloc() image data");
xcb_image_destroy(xi);
free(formatsReply);
return XCB_NONE;
}
memcpy(xi->data, img.constBits(), img.byteCount());
xcb_pixmap_t pix = xcb_generate_id(conn);