st/xorg: Check that ms->api->destroy is not NULL before calling it.
authorMichel Dänzer <daenzer@vmware.com>
Thu, 1 Oct 2009 14:45:11 +0000 (16:45 +0200)
committerMichel Dänzer <daenzer@vmware.com>
Thu, 1 Oct 2009 14:45:11 +0000 (16:45 +0200)
Fixes potential crash on X server shutdown.

src/gallium/state_trackers/xorg/xorg_driver.c

index 8c4cba035a138fe0a40fa21cd1efe1e5815925cf..4bc87aa613d083ab3bc454666fc627a3cb26544f 100644 (file)
@@ -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;