summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2013-04-10 07:47:08 -0700
committerIan Romanick <[email protected]>2013-05-10 16:41:30 -0700
commit13f7cd25f34bb6a5950101bb2ca774c037e9a676 (patch)
treef205f6f8cd17a234e175022f830191e3ab3334a3
parente928a3059c6addba9014b375b8b3d93ea31c4984 (diff)
mesa: Don't leak shared state when context initialization fails
Back up at line 1017 (not shown in patch), we add a reference to the shared state. Several places after that may divert to the error handler, but, as far as I can tell, nothing ever unreferences the shared state. Fixes issue identified by Klocwork analysis: Resource acquired to 'shared->TexMutex' at line 1012 may be lost here. Also there is one similar error on line 1087. NOTE: This is a candidate for the stable branches. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> (cherry picked from commit 6e06550e4e0682c616fc0228beee419618421f2c)
-rw-r--r--src/mesa/main/context.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index df57b766e01..eb0f422ee31 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1080,6 +1080,7 @@ _mesa_initialize_context(struct gl_context *ctx,
return GL_TRUE;
fail:
+ _mesa_reference_shared_state(ctx, &ctx->Shared, NULL);
free(ctx->BeginEnd);
free(ctx->Exec);
free(ctx->Save);