[PATCH 1/3] Check whether tmp_image is not NULL before trying to dereference it

Arnaud Fontaine arnau at debian.org
Sun Dec 19 07:12:52 PST 2010


---
 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++) {
-- 
1.7.2.3


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0002-Fix-GCC-warnings-due-to-functions-not-being-declared.patch



More information about the Xcb mailing list