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>
(cherry picked from commit c7fa6a0a0d)
This commit is contained in:
Dave Airlie 2018-09-12 10:50:21 +10:00 committed by Olivier Fourdan
parent 26a83f9833
commit bb384d0b11
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,