summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/xlib/xm_api.c
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2008-05-12 14:09:50 +0100
committerKeith Whitwell <[email protected]>2008-05-12 17:40:55 +0100
commit2258f6b437705860912be300e728efbde60e2140 (patch)
tree84a755b162150ae3d1b46d55ed3e61407977c3b6 /src/gallium/winsys/xlib/xm_api.c
parent7ddb925b8bc6c18eba953e34d2b630a3a6593f05 (diff)
xlib: add failure paths for context creation
Diffstat (limited to 'src/gallium/winsys/xlib/xm_api.c')
-rw-r--r--src/gallium/winsys/xlib/xm_api.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gallium/winsys/xlib/xm_api.c b/src/gallium/winsys/xlib/xm_api.c
index 26b722f3439..8a32c54349b 100644
--- a/src/gallium/winsys/xlib/xm_api.c
+++ b/src/gallium/winsys/xlib/xm_api.c
@@ -797,8 +797,14 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
pipe = xmesa_create_i965simple(xmesa_get_pipe_winsys_aub(v));
}
+ if (pipe == NULL)
+ goto fail;
+
c->st = st_create_context(pipe, &v->mesa_visual,
share_list ? share_list->st : NULL);
+ if (c->st == NULL)
+ goto fail;
+
mesaCtx = c->st->ctx;
c->st->ctx->DriverCtx = c;
@@ -818,6 +824,14 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
#endif
return c;
+
+ fail:
+ if (c->st)
+ st_destroy_context(c->st);
+ if (pipe)
+ pipe->destroy(pipe);
+ FREE(c);
+ return NULL;
}