diff options
author | Arnaud Fontaine <arnau@debian.org> | 2010-12-20 00:12:52 +0900 |
---|---|---|
committer | Arnaud Fontaine <arnau@debian.org> | 2010-12-23 15:08:29 +0900 |
commit | 25965db002825ccc3295df6ae0c931d296f2ba2a (patch) | |
tree | ea588dea6ea63fe5c0df689be329c7c41d2179c4 | |
parent | d53090fd635bf14523b11e6acbc385fd6e7d8823 (diff) | |
download | util-image-25965db002825ccc3295df6ae0c931d296f2ba2a.tar.gz |
Check whether tmp_image is not NULL before trying to dereference it
-rw-r--r-- | image/xcb_image.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/image/xcb_image.c b/image/xcb_image.c index ab2d144..8a73b12 100644 --- a/image/xcb_image.c +++ b/image/xcb_image.c @@ -327,16 +327,18 @@ xcb_image_get (xcb_connection_t * conn, xcb_image_t * tmp_image = xcb_image_create_native(conn, width, height, format, imrep->depth, 0, 0, 0); - int i; - uint32_t rpm = plane_mask; - uint8_t * src_plane = image->data; - uint8_t * dst_plane = tmp_image->data; - uint32_t size = image->height * image->stride; if (!tmp_image) { free(imrep); return 0; } + + int i; + uint32_t rpm = plane_mask; + uint8_t * src_plane = image->data; + uint8_t * dst_plane = tmp_image->data; + uint32_t size = image->height * image->stride; + if (tmp_image->bit_order == XCB_IMAGE_ORDER_MSB_FIRST) rpm = xcb_bit_reverse(plane_mask, imrep->depth); for (i = 0; i < imrep->depth; i++) { |