Mesa (master): glx: Added missing null check in GetDrawableAttribute()
Ville Syrjala
vsyrjala at kemper.freedesktop.org
Thu Jun 26 12:47:13 UTC 2014
Module: Mesa
Branch: master
Commit: 2670d0f91d631c72d83e97d1ecc512a4a624f669
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2670d0f91d631c72d83e97d1ecc512a4a624f669
Author: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
Date: Fri Apr 25 11:16:50 2014 +0300
glx: Added missing null check in GetDrawableAttribute()
For GLX_BACK_BUFFER_AGE_EXT query added extra null check.
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/glx/glx_pbuffer.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
index 8f48093..231ab20 100644
--- a/src/glx/glx_pbuffer.c
+++ b/src/glx/glx_pbuffer.c
@@ -319,8 +319,8 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
pdraw = GetGLXDRIDrawable(dpy, drawable);
if (attribute == GLX_BACK_BUFFER_AGE_EXT) {
- struct glx_screen *psc = pdraw->psc;
struct glx_context *gc = __glXGetCurrentContext();
+ struct glx_screen *psc;
/* The GLX_EXT_buffer_age spec says:
*
@@ -328,12 +328,16 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
* the calling thread's current context a GLXBadDrawable error is
* generated."
*/
- if (gc == NULL || gc->currentDpy != dpy ||
- (gc->currentDrawable != drawable && gc->currentReadable != drawable)) {
- __glXSendError(dpy, GLXBadDrawable, drawable, X_GLXGetDrawableAttributes, false);
+ if (pdraw == NULL || gc == NULL || gc->currentDpy != dpy ||
+ (gc->currentDrawable != drawable &&
+ gc->currentReadable != drawable)) {
+ __glXSendError(dpy, GLXBadDrawable, drawable,
+ X_GLXGetDrawableAttributes, false);
return 0;
}
+ psc = pdraw->psc;
+
if (psc->driScreen->getBufferAge != NULL)
*value = psc->driScreen->getBufferAge(pdraw);
More information about the mesa-commit
mailing list