From 9fe360bf2be5c959fb21835955ef550098ccbbf0 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Sun, 16 Jun 2013 00:07:57 +0100 Subject: hw/xwin: Avoid a null dereference if CreateDIBSection() fails in NetWMToWinIconAlpha() Avoid a null dereference of DIB_pixels if CreateDIBSection() fails in NetWMToWinIconAlpha() Signed-off-by: Jon TURNEY Reviewed-by: Colin Harrison --- hw/xwin/winmultiwindowicons.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'hw/xwin/winmultiwindowicons.c') diff --git a/hw/xwin/winmultiwindowicons.c b/hw/xwin/winmultiwindowicons.c index bcc5688df..0531ad6c7 100644 --- a/hw/xwin/winmultiwindowicons.c +++ b/hw/xwin/winmultiwindowicons.c @@ -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); -- cgit v1.2.3