diff --git a/src/plugins/platforms/xcb/qxcbimage.cpp b/src/plugins/platforms/xcb/qxcbimage.cpp index 3fb5e2c00e..569e4fc4e4 100644 --- a/src/plugins/platforms/xcb/qxcbimage.cpp +++ b/src/plugins/platforms/xcb/qxcbimage.cpp @@ -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);