Mesa (master): glx: Fix use after free problem
Kristian Høgsberg
krh at kemper.freedesktop.org
Wed Sep 8 22:56:03 UTC 2010
Module: Mesa
Branch: master
Commit: 659dab6be6bc82f8a0551c30f1133e0010f04ed8
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=659dab6be6bc82f8a0551c30f1133e0010f04ed8
Author: Kristian Høgsberg <krh at bitplanet.net>
Date: Wed Sep 8 14:51:18 2010 -0400
glx: Fix use after free problem
---
src/glx/glxcurrent.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
index 710985b..0d359f7 100644
--- a/src/glx/glxcurrent.c
+++ b/src/glx/glxcurrent.c
@@ -248,12 +248,6 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
oldGC->currentDrawable = None;
oldGC->currentReadable = None;
oldGC->thread_id = 0;
- if (oldGC->xid == None && oldGC != gc)
- /* We are switching away from a context that was
- * previously destroyed, so we need to free the memory
- * for the old handle.
- */
- oldGC->vtable->destroy(oldGC);
}
if (gc) {
@@ -267,6 +261,13 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
__glXSetCurrentContextNull();
}
+ if (oldGC != &dummyContext && oldGC->xid == None && oldGC != gc) {
+ /* We are switching away from a context that was
+ * previously destroyed, so we need to free the memory
+ * for the old handle. */
+ oldGC->vtable->destroy(oldGC);
+ }
+
if (ret) {
__glXGenerateError(dpy, gc, None, ret, X_GLXMakeContextCurrent);
return GL_FALSE;
More information about the mesa-commit
mailing list