diff options
author | Dave Airlie <airlied@redhat.com> | 2018-09-12 10:50:21 +1000 |
---|---|---|
committer | Olivier Fourdan <ofourdan@redhat.com> | 2018-10-04 17:26:09 +0200 |
commit | bb384d0b110a99f2d935ed73d6589af46f818823 (patch) | |
tree | 5400698f8d2830fc79d4c8178a06dda68814b84a | |
parent | 26a83f9833054f5cf7c7d73b0f5aa080d400c26b (diff) |
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 c7fa6a0a0d4ad28ee21b8dd9ad4fbe33f462bc71)
-rw-r--r-- | fb/fboverlay.c | 6 |
1 files changed, 3 insertions, 3 deletions
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, |