xf86DeleteScreen: move check for NULL pScrn before first dereference
Flagged by cppcheck 1.62: [hw/xfree86/common/xf86Helper.c:220] -> [hw/xfree86/common/xf86Helper.c:231]: (warning) Possible null pointer dereference: pScrn - otherwise it is redundant to check it against null. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
e6733ae91b
commit
c1ac89c793
|
@ -217,6 +217,10 @@ xf86DeleteScreen(ScrnInfoPtr pScrn)
|
||||||
int i;
|
int i;
|
||||||
int scrnIndex;
|
int scrnIndex;
|
||||||
Bool is_gpu = FALSE;
|
Bool is_gpu = FALSE;
|
||||||
|
|
||||||
|
if (!pScrn)
|
||||||
|
return;
|
||||||
|
|
||||||
if (pScrn->is_gpu) {
|
if (pScrn->is_gpu) {
|
||||||
/* First check if the screen is valid */
|
/* First check if the screen is valid */
|
||||||
if (xf86NumGPUScreens == 0 || xf86GPUScreens == NULL)
|
if (xf86NumGPUScreens == 0 || xf86GPUScreens == NULL)
|
||||||
|
@ -228,9 +232,6 @@ xf86DeleteScreen(ScrnInfoPtr pScrn)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pScrn)
|
|
||||||
return;
|
|
||||||
|
|
||||||
scrnIndex = pScrn->scrnIndex;
|
scrnIndex = pScrn->scrnIndex;
|
||||||
/* If a FreeScreen function is defined, call it here */
|
/* If a FreeScreen function is defined, call it here */
|
||||||
if (pScrn->FreeScreen != NULL)
|
if (pScrn->FreeScreen != NULL)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user