[WIN32K] Add missing NULL checks

Also fix an old copy-pasta.
This commit is contained in:
Timo Kreuzer 2022-07-23 17:08:12 +02:00
parent 5f4db56486
commit 090ccb3d8e
2 changed files with 11 additions and 1 deletions

View file

@ -333,6 +333,11 @@ IntCreateCompatibleBitmap(
Planes ? Planes : 1,
Bpp ? Bpp : dibs.dsBm.bmBitsPixel,
NULL);
if (Bmp == NULL)
{
DPRINT1("Failed to allocate a bitmap!\n");
return NULL;
}
psurfBmp = SURFACE_ShareLockSurface(Bmp);
ASSERT(psurfBmp);
@ -342,7 +347,7 @@ IntCreateCompatibleBitmap(
/* Set flags */
psurfBmp->flags = API_BITMAP;
psurfBmp->hdc = NULL; // FIXME:
psurf->SurfObj.hdev = (HDEV)Dc->ppdev;
psurfBmp->SurfObj.hdev = (HDEV)Dc->ppdev;
SURFACE_ShareUnlockSurface(psurfBmp);
}
else if (Count == sizeof(DIBSECTION))

View file

@ -69,6 +69,11 @@ CreateDIBPalette(
0,
0,
0);
if (ppal == NULL)
{
DPRINT1("Failed to allocate palette.\n");
return NULL;
}
/* Check if the BITMAPINFO specifies how many colors to use */
if ((pbmi->bmiHeader.biSize >= sizeof(BITMAPINFOHEADER)) &&