summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/wgl
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2009-01-28 20:19:17 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2009-01-28 20:19:17 +0000
commit866587942c7053cdcb7443ed00ce6d902c010631 (patch)
treee39f93e587dfd465eab0e95c7c10bccdfc3e653c /src/gallium/state_trackers/wgl
parent9a58a9d6ca19a2933b9fddfa3c870786f35183b0 (diff)
stw: clean up error paths
Diffstat (limited to 'src/gallium/state_trackers/wgl')
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_context.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c
index 6a26c163a9..62e26ab5da 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_context.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_context.c
@@ -64,10 +64,10 @@ stw_create_context(
int iLayerPlane )
{
uint pfi;
- const struct pixelformat_info *pf;
- struct wgl_context *ctx;
- GLvisual *visual;
- struct pipe_context *pipe;
+ const struct pixelformat_info *pf = NULL;
+ struct wgl_context *ctx = NULL;
+ GLvisual *visual = NULL;
+ struct pipe_context *pipe = NULL;
if (iLayerPlane != 0)
return NULL;
@@ -103,34 +103,36 @@ stw_create_context(
0,
0,
(pf->flags & PF_FLAG_MULTISAMPLED) ? stw_query_samples() : 0 );
- if (visual == NULL) {
- FREE( ctx );
- return NULL;
- }
+ if (visual == NULL)
+ goto fail;
pipe = stw_dev->stw_winsys->create_context( stw_dev->screen );
- if (!pipe) {
- _mesa_destroy_visual( visual );
- FREE( ctx );
- return NULL;
- }
-
+ if (pipe == NULL)
+ goto fail;
+
assert(!pipe->priv);
pipe->priv = hdc;
ctx->st = st_create_context( pipe, visual, NULL );
- if (ctx->st == NULL) {
- pipe->destroy( pipe );
- _mesa_destroy_visual( visual );
- FREE( ctx );
- return NULL;
- }
+ if (ctx->st == NULL)
+ goto fail;
+
ctx->st->ctx->DriverCtx = ctx;
ctx->next = ctx_head;
ctx_head = ctx;
return (HGLRC) ctx;
+
+fail:
+ if (visual)
+ _mesa_destroy_visual( visual );
+
+ if (pipe)
+ pipe->destroy( pipe );
+
+ FREE( ctx );
+ return NULL;
}