{
GLcontext *ctx = &osmesa->mesa;
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
+ if (!_swrast_CreateContext( ctx ) ||
+ !_ac_CreateContext( ctx ) ||
+ !_tnl_CreateContext( ctx ) ||
+ !_swsetup_CreateContext( ctx )) {
+ _mesa_destroy_visual(osmesa->gl_visual);
+ _mesa_free_context_data(ctx);
+ _mesa_free(osmesa);
+ return NULL;
+ }
_swsetup_Wakeup( ctx );
hook_in_driver_functions( ctx );
/* Initialize the software rasterizer and helper modules.
*/
- _swrast_CreateContext( mesaCtx );
- _ac_CreateContext( mesaCtx );
- _tnl_CreateContext( mesaCtx );
- _swsetup_CreateContext( mesaCtx );
+ if (!_swrast_CreateContext( mesaCtx ) ||
+ !_ac_CreateContext( mesaCtx ) ||
+ !_tnl_CreateContext( mesaCtx ) ||
+ !_swsetup_CreateContext( mesaCtx )) {
+ _mesa_free_context_data(&c->mesa);
+ _mesa_free(c);
+ return NULL;
+ }
/* tnl setup */
tnl = TNL_CONTEXT(mesaCtx);