aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-11-08 12:33:11 +0100
committermarha <marha@users.sourceforge.net>2011-11-08 12:33:11 +0100
commita3d796bcc7de83fd88b42e09c6a82a8df4f9b836 (patch)
treecba03a8499a0ea71fac0e59ae1f91748baf0479f
parentc4f95f53617d5efd78de5b8b6a13fe937fb5478f (diff)
downloadvcxsrv-a3d796bcc7de83fd88b42e09c6a82a8df4f9b836.tar.gz
vcxsrv-a3d796bcc7de83fd88b42e09c6a82a8df4f9b836.tar.bz2
vcxsrv-a3d796bcc7de83fd88b42e09c6a82a8df4f9b836.zip
Solved possible crashes due to null pointer access
-rw-r--r--xorg-server/hw/xwin/winshaddd.c2
-rw-r--r--xorg-server/hw/xwin/winshadddnl.c12
-rw-r--r--xorg-server/hw/xwin/winshadgdi.c2
3 files changed, 10 insertions, 6 deletions
diff --git a/xorg-server/hw/xwin/winshaddd.c b/xorg-server/hw/xwin/winshaddd.c
index b4fa47bae..cf4dd62f1 100644
--- a/xorg-server/hw/xwin/winshaddd.c
+++ b/xorg-server/hw/xwin/winshaddd.c
@@ -722,7 +722,7 @@ winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen)
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
/* Destroy the thread startup mutex */
- pthread_mutex_destroy (&pScreenPriv->pmServerStarted);
+ if (pScreenPriv->pmServerStarted) pthread_mutex_destroy (&pScreenPriv->pmServerStarted);
#endif
/* Kill our screeninfo's pointer to the screen */
diff --git a/xorg-server/hw/xwin/winshadddnl.c b/xorg-server/hw/xwin/winshadddnl.c
index b7ba8ef94..2f7e34243 100644
--- a/xorg-server/hw/xwin/winshadddnl.c
+++ b/xorg-server/hw/xwin/winshadddnl.c
@@ -117,9 +117,13 @@ static HRESULT myIDirectDrawSurface4_Blt( ScreenPtr pScreen, RECT *pRect, RECT *
unsigned i;
winScreenPriv(pScreen);
+
for (i = 0; i < 3; ++i)
{
- ddrval = IDirectDrawSurface4_Blt(pScreenPriv->pddsPrimary4, pRect, pScreenPriv->pddsShadow4, prcSrc, DDBLT_WAIT, NULL);
+ if (pScreenPriv->pddsPrimary4)
+ ddrval = IDirectDrawSurface4_Blt(pScreenPriv->pddsPrimary4, pRect, pScreenPriv->pddsShadow4, prcSrc, DDBLT_WAIT, NULL);
+ else
+ ddrval = DDERR_SURFACELOST; // Surface has been closed
/* Try to regain the primary surface and blit again if we've lost it */
if (ddrval == DDERR_SURFACELOST)
{
@@ -162,7 +166,7 @@ static HRESULT myIDirectDrawSurface4_Blt( ScreenPtr pScreen, RECT *pRect, RECT *
"lost: %08x %d\n", ddrval, ddrval);
}
break;
- }
+ }
return ddrval;
}
@@ -821,7 +825,7 @@ winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen)
{
winScreenPriv(pScreen);
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- Bool fReturn;
+ Bool fReturn=FALSE;
winDebug ("winCloseScreenShadowDDNL - Freeing screen resources\n");
@@ -862,7 +866,7 @@ winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen)
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
/* Destroy the thread startup mutex */
- pthread_mutex_destroy (&pScreenPriv->pmServerStarted);
+ if (pScreenPriv->pmServerStarted) pthread_mutex_destroy (&pScreenPriv->pmServerStarted);
#endif
/* Kill our screeninfo's pointer to the screen */
diff --git a/xorg-server/hw/xwin/winshadgdi.c b/xorg-server/hw/xwin/winshadgdi.c
index 718101299..545d1f0e0 100644
--- a/xorg-server/hw/xwin/winshadgdi.c
+++ b/xorg-server/hw/xwin/winshadgdi.c
@@ -656,7 +656,7 @@ winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen)
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
/* Destroy the thread startup mutex */
- pthread_mutex_destroy (&pScreenPriv->pmServerStarted);
+ if (pScreenPriv->pmServerStarted) pthread_mutex_destroy (&pScreenPriv->pmServerStarted);
#endif
/* Invalidate our screeninfo's pointer to the screen */