diff options
author | Laszlo Agocs <laszlo.p.agocs@nokia.com> | 2011-06-09 11:05:56 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.p.agocs@nokia.com> | 2011-06-09 11:08:05 +0200 |
commit | d88a773218468c6532b2bb563540d1fe1c5f5376 (patch) | |
tree | 0c04bdb6b08a2034a9540d501b1bac10b460e292 /src/plugins/platforms | |
parent | 06c56cb46442463534cb88f5b71beae809fc5a1a (diff) |
Bail out from cursor creation when malloc fails.
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbimage.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
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); |