From: Michel Dänzer Date: Thu, 1 Oct 2009 14:45:11 +0000 (+0200) Subject: st/xorg: Check that ms->api->destroy is not NULL before calling it. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e32a341be66391e0ea1cc6ce19bbd57997f46b6b;p=mesa.git st/xorg: Check that ms->api->destroy is not NULL before calling it. Fixes potential crash on X server shutdown. --- diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 8c4cba035a1..4bc87aa613d 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;