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@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Kenneth Graunke 2012-01-10 23:32:50 -08:00
parent dce4c368b5
commit 10a6fde333

View file

@ -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.
*/