From bb384d0b110a99f2d935ed73d6589af46f818823 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 12 Sep 2018 10:50:21 +1000 Subject: fboverlay: move bpp checks above malloc Avoids having to free the malloced object. Pointed out by coverity. Signed-off-by: Dave Airlie (cherry picked from commit c7fa6a0a0d4ad28ee21b8dd9ad4fbe33f462bc71) --- fb/fboverlay.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'fb') diff --git a/fb/fboverlay.c b/fb/fboverlay.c index a028a8de1..d47a7c67b 100644 --- a/fb/fboverlay.c +++ b/fb/fboverlay.c @@ -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, -- cgit v1.2.3