fboverlay: move bpp checks above malloc

Avoids having to free the malloced object.

Pointed out by coverity.

Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Dave Airlie 2018-09-12 10:50:21 +10:00
parent 51ae6126dc
commit c7fa6a0a0d
1 changed files with 3 additions and 3 deletions

View File

@ -279,11 +279,11 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen,
(&fbOverlayScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
return FALSE;
pScrPriv = malloc(sizeof(FbOverlayScrPrivRec));
if (!pScrPriv)
if (bpp1 == 24 || bpp2 == 24)
return FALSE;
if (bpp1 == 24 || bpp2 == 24)
pScrPriv = malloc(sizeof(FbOverlayScrPrivRec));
if (!pScrPriv)
return FALSE;
if (!fbInitVisuals(&visuals, &depths, &nvisuals, &ndepths, &depth1,