summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2012-01-10 23:32:50 -0800
committerKenneth Graunke <[email protected]>2012-01-11 12:13:49 -0800
commit10a6fde333f0170fbac70924581c647e531aba3e (patch)
treeb9b6c124a67d3af97f664e72d72a1d496ff54780 /src
parentdce4c368b5536716770e5cabef0321db8537a6d9 (diff)
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 <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/glx/dri_common.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index 8feb58777b8..ed0b134f00b 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.
*/