aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xorg-server/glx/glxcmds.c6
-rw-r--r--xorg-server/glx/glxdriswrast.c7
2 files changed, 13 insertions, 0 deletions
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;
}