hw/xwin: Fix possible null ptr deref in winActivateAppPrimaryDD()

Signed-off-by: Ryan Pavlik <rpavlik@iastate.edu>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
This commit is contained in:
Ryan Pavlik 2011-10-28 09:52:34 -05:00 committed by Jon TURNEY
parent a492c02649
commit 3c501691a0

View File

@ -461,12 +461,12 @@ static Bool
winActivateAppPrimaryDD (ScreenPtr pScreen) winActivateAppPrimaryDD (ScreenPtr pScreen)
{ {
winScreenPriv(pScreen); winScreenPriv(pScreen);
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
RECT rcSrc, rcClient; RECT rcSrc, rcClient;
HRESULT ddrval = DD_OK; HRESULT ddrval = DD_OK;
/* Check for errors */ /* Check for errors */
if (pScreenPriv == NULL if (pScreenPriv == NULL
|| pScreenPriv->pScreenInfo == NULL
|| pScreenPriv->pddsPrimary == NULL || pScreenPriv->pddsPrimary == NULL
|| pScreenPriv->pddsOffscreen == NULL) || pScreenPriv->pddsOffscreen == NULL)
return FALSE; return FALSE;
@ -500,8 +500,8 @@ winActivateAppPrimaryDD (ScreenPtr pScreen)
/* Setup a source rectangle */ /* Setup a source rectangle */
rcSrc.left = 0; rcSrc.left = 0;
rcSrc.top = 0; rcSrc.top = 0;
rcSrc.right = pScreenInfo->dwWidth; rcSrc.right = pScreenPriv->pScreenInfo->dwWidth;
rcSrc.bottom = pScreenInfo->dwHeight; rcSrc.bottom = pScreenPriv->pScreenInfo->dwHeight;
ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary, ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary,
&rcClient, &rcClient,