summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/x11/xm_api.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-12-26 16:26:58 -0700
committerBrian Paul <[email protected]>2012-12-31 18:17:58 -0700
commit05cd6cfd5f5a128404f09c4de1a7cf12f3f6f08a (patch)
treed1ff8affa05fb5642e33f160116a8a5f6eab5349 /src/mesa/drivers/x11/xm_api.c
parent66ea6e8ec3f7ee44e0011b1dd563fef76ead8bc5 (diff)
xlib: handle _mesa_initialize_visual()'s return value
If the call fails, we should return NULL from XMesaCreateVisual(). This was found when Waffle tried to create a visual with depth/stencil bits = -1. That's an illegal value for glXChooseFBConfig() and we should return NULL in that situation. Note: This is a candidate for the stable branches.
Diffstat (limited to 'src/mesa/drivers/x11/xm_api.c')
-rw-r--r--src/mesa/drivers/x11/xm_api.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 8105f4dbd52..2ba65ffd787 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -847,15 +847,18 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
alpha_bits = v->mesa_visual.alphaBits;
}
- _mesa_initialize_visual( &v->mesa_visual,
- db_flag, stereo_flag,
- red_bits, green_bits,
- blue_bits, alpha_bits,
- depth_size,
- stencil_size,
- accum_red_size, accum_green_size,
- accum_blue_size, accum_alpha_size,
- 0 );
+ if (!_mesa_initialize_visual(&v->mesa_visual,
+ db_flag, stereo_flag,
+ red_bits, green_bits,
+ blue_bits, alpha_bits,
+ depth_size,
+ stencil_size,
+ accum_red_size, accum_green_size,
+ accum_blue_size, accum_alpha_size,
+ 0)) {
+ FREE(v);
+ return NULL;
+ }
/* XXX minor hack */
v->mesa_visual.level = level;