Mesa (master): glx: Don' t segfault if glXGetContextIDEXT is pased a NULL context

Ian Romanick idr at kemper.freedesktop.org
Mon Dec 19 22:56:29 UTC 2011


Module: Mesa
Branch: master
Commit: 3b9b42250ca9f0da6e979afc047d1c8524466076
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3b9b42250ca9f0da6e979afc047d1c8524466076

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Wed Dec  7 11:37:01 2011 -0800

glx: Don't segfault if glXGetContextIDEXT is pased a NULL context

Fixes the piglit test glx-get-context-id.

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Adam Jackson <ajax at redhat.com>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/glx/glxcmds.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 6ef7b92..f2c1884 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -1563,7 +1563,7 @@ _X_EXPORT GLXContextID glXGetContextIDEXT(const GLXContext ctx_user)
 {
    struct glx_context *ctx = (struct glx_context *) ctx_user;
 
-   return ctx->xid;
+   return (ctx == NULL) ? None : ctx->xid;
 }
 
 _X_EXPORT




More information about the mesa-commit mailing list