From 49ec57d5094be0dd2b67435ac7bb04ead780f36d Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 24 Aug 2012 13:23:01 +1000 Subject: [PATCH] dix: free default colormap before screen deletion If we don't free this here, it gets freed later in the resource cleanups, however it then looks up up pmap->pScreen, which we freed already in this function. So free the default colormap when we should. This fixes a bug after a couple of hotplug cycles when you try to exit the X server and it crashes. Reviewed-by: Keith Packard Signed-off-by: Dave Airlie --- dix/dispatch.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dix/dispatch.c b/dix/dispatch.c index 3c6a591db..0ce10c2f7 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -3904,6 +3904,10 @@ RemoveGPUScreen(ScreenPtr pScreen) } screenInfo.numGPUScreens--; + /* this gets freed later in the resource list, but without + * the screen existing it causes crashes - so remove it here */ + if (pScreen->defColormap) + FreeResource(pScreen->defColormap, RT_COLORMAP); free(pScreen); }