Mesa (master): glx/dri: Initialize api even if num_attribs == 0.
Kenneth Graunke
kwg at kemper.freedesktop.org
Wed Jan 11 20:14:43 UTC 2012
Module: Mesa
Branch: master
Commit: 10a6fde333f0170fbac70924581c647e531aba3e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=10a6fde333f0170fbac70924581c647e531aba3e
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Tue Jan 10 23:32:50 2012 -0800
glx/dri: Initialize api even if num_attribs == 0.
Both dri2_create_context_attribs and drisw_create_context_attribs call
dri2_convert_glx_attribs, expecting it to fill in *api on success.
However, when num_attribs == 0, it was returning true without setting
*api, causing the caller to use an uninitialized value.
Tested-by: Vadim Girlin <vadimgirlin at gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/glx/dri_common.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index 8feb587..ed0b134 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -429,8 +429,10 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
uint32_t profile;
int render_type = GLX_RGBA_TYPE;
- if (num_attribs == 0)
+ if (num_attribs == 0) {
+ *api = __DRI_API_OPENGL;
return true;
+ }
/* This is actually an internal error, but what the heck.
*/
More information about the mesa-commit
mailing list