Mesa (master): st/xorg: Check that ms->api-> destroy is not NULL before calling it.

Michel Dänzer daenzer at kemper.freedesktop.org
Thu Oct 1 14:46:24 UTC 2009


Module: Mesa
Branch: master
Commit: e32a341be66391e0ea1cc6ce19bbd57997f46b6b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e32a341be66391e0ea1cc6ce19bbd57997f46b6b

Author: Michel Dänzer <daenzer at vmware.com>
Date:   Thu Oct  1 16:45:11 2009 +0200

st/xorg: Check that ms->api->destroy is not NULL before calling it.

Fixes potential crash on X server shutdown.

---

 src/gallium/state_trackers/xorg/xorg_driver.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
index 8c4cba0..4bc87aa 100644
--- a/src/gallium/state_trackers/xorg/xorg_driver.c
+++ b/src/gallium/state_trackers/xorg/xorg_driver.c
@@ -726,8 +726,10 @@ CloseScreen(int scrnIndex, ScreenPtr pScreen)
     if (ms->exa)
 	xorg_exa_close(pScrn);
 
+    if (ms->api->destroy)
 	ms->api->destroy(ms->api);
-	ms->api = NULL;
+    ms->api = NULL;
+
     drmClose(ms->fd);
     ms->fd = -1;
 




More information about the mesa-commit mailing list