hw/xwin: Avoid a null dereference if CreateDIBSection() fails in NetWMToWinIconAlpha()
authorJon TURNEY <jon.turney@dronecode.org.uk>
Sat, 15 Jun 2013 23:07:57 +0000 (00:07 +0100)
committerJon TURNEY <jon.turney@dronecode.org.uk>
Tue, 23 Jul 2013 22:59:31 +0000 (23:59 +0100)
Avoid a null dereference of DIB_pixels if CreateDIBSection() fails in
NetWMToWinIconAlpha()

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
hw/xwin/winmultiwindowicons.c

index bcc5688..0531ad6 100644 (file)
@@ -257,6 +257,10 @@ NetWMToWinIconAlpha(uint32_t * icon)
                                    DIB_RGB_COLORS, (void **) &DIB_pixels, NULL,
                                    0);
     ReleaseDC(NULL, hdc);
+
+    if (!ii.hbmColor)
+      return NULL;
+
     ii.hbmMask = CreateBitmap(width, height, 1, 1, NULL);
     memcpy(DIB_pixels, pixels, height * width * 4);