diff --git a/reactos/subsystems/win32/win32k/objects/bitmaps.c b/reactos/subsystems/win32/win32k/objects/bitmaps.c index 6918a68877c..51a91f9c304 100644 --- a/reactos/subsystems/win32/win32k/objects/bitmaps.c +++ b/reactos/subsystems/win32/win32k/objects/bitmaps.c @@ -662,6 +662,11 @@ BITMAPOBJ_CopyBitmap(HBITMAP hBitmap) if (resBitmap) { buf = ExAllocatePoolWithTag (PagedPool, bm.bmWidthBytes * abs(bm.bmHeight), TAG_BITMAP); + if (buf == NULL) + { + GDIOBJ_UnlockObjByPtr(GdiHandleTable, resBitmap); + return 0; + } IntGetBitmapBits (Bitmap, bm.bmWidthBytes * abs(bm.bmHeight), buf); IntSetBitmapBits (resBitmap, bm.bmWidthBytes * abs(bm.bmHeight), buf); ExFreePool (buf);