From d88a773218468c6532b2bb563540d1fe1c5f5376 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 9 Jun 2011 11:05:56 +0200 Subject: Bail out from cursor creation when malloc fails. --- src/plugins/platforms/xcb/qxcbimage.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/plugins/platforms') 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); -- cgit v1.2.3