summaryrefslogtreecommitdiff
path: root/glx
diff options
context:
space:
mode:
authorJie Luo <clotho67@gmail.com>2008-08-17 23:13:22 +0200
committerMaarten Maathuis <madman2003@gmail.com>2008-08-17 23:13:22 +0200
commit99583b43a9a202d047ff417d47485e4c0e0c9670 (patch)
tree6cc3ec13129b986dd8a6914f8679238dc0205dd4 /glx
parent421b7e8f12083e9518fa7deda968a2f73c9a0006 (diff)
glx: avoid possible NULLptr deref, fix #16884
Diffstat (limited to 'glx')
-rw-r--r--glx/glxcmds.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 19d8674a1..aedbc02b0 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -148,8 +148,10 @@ void
__glXContextDestroy(__GLXcontext *context)
{
if (!context->isDirect) {
- __glXUnrefDrawable(context->drawPriv);
- __glXUnrefDrawable(context->readPriv);
+ if (context->drawPriv)
+ __glXUnrefDrawable(context->drawPriv);
+ if (context->readPriv)
+ __glXUnrefDrawable(context->readPriv);
}
__glXFlushContextCache();
}
@@ -621,8 +623,10 @@ DoMakeCurrent(__GLXclientState *cl,
}
__glXFlushContextCache();
if (!prevglxc->isDirect) {
- __glXUnrefDrawable(prevglxc->drawPriv);
- __glXUnrefDrawable(prevglxc->readPriv);
+ if (prevglxc->drawPriv)
+ __glXUnrefDrawable(prevglxc->drawPriv);
+ if (prevglxc->readPriv)
+ __glXUnrefDrawable(prevglxc->readPriv);
}
}