From 1b73fdf9c9aa2330380300d204fb47f512cfb6e2 Mon Sep 17 00:00:00 2001 From: marha Date: Thu, 23 Feb 2012 12:37:25 +0100 Subject: Solved possible crashes when drawable cannot be created. --- xorg-server/glx/glxcmds.c | 6 ++++++ xorg-server/glx/glxdriswrast.c | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/xorg-server/glx/glxcmds.c b/xorg-server/glx/glxcmds.c index ee3f94dfb..b88d6f663 100644 --- a/xorg-server/glx/glxcmds.c +++ b/xorg-server/glx/glxcmds.c @@ -499,6 +499,12 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client, pDraw, drawId, GLX_DRAWABLE_WINDOW, drawId, glxc->config); + if (!pGlxDraw) + { + client->errorValue = drawId; + *error = BadMatch; + return NULL; + } /* since we are creating the drawablePrivate, drawId should be new */ if (!AddResource(drawId, __glXDrawableRes, pGlxDraw)) { diff --git a/xorg-server/glx/glxdriswrast.c b/xorg-server/glx/glxdriswrast.c index 26936c3dd..434653e70 100644 --- a/xorg-server/glx/glxdriswrast.c +++ b/xorg-server/glx/glxdriswrast.c @@ -334,6 +334,13 @@ __glXDRIscreenCreateDrawable(ClientPtr client, (*driScreen->swrast->createNewDrawable)(driScreen->driScreen, config->driConfig, private); + if (!private->driDrawable) + { + FreeGC(private->gc, (GContext)0); + FreeGC(private->swapgc, (GContext)0); + free(private); + return NULL; + } return &private->base; } -- cgit v1.2.3