summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorVinson Lee <[email protected]>2013-01-31 23:45:13 -0800
committerVinson Lee <[email protected]>2013-02-01 22:52:22 -0800
commit8a4d952d1074e648a99e44ed558a6f0f5b4460a7 (patch)
tree1b08f25566a87e3638bdd11880e76b408d7dc422 /src/gallium/drivers
parent080e91aa07aaf2cc3ebb98abcb77eda868167687 (diff)
r600g: Fix memory leak.
Fixes resource leak defect reported by Coverity. Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/r600/r600_hw_context.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
index a89f23069d3..ebcd682bc81 100644
--- a/src/gallium/drivers/r600/r600_hw_context.c
+++ b/src/gallium/drivers/r600/r600_hw_context.c
@@ -201,8 +201,10 @@ int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg,
/* create block table if it doesn't exist */
if (!range->blocks)
range->blocks = calloc(1 << HASH_SHIFT, sizeof(void *));
- if (!range->blocks)
+ if (!range->blocks) {
+ free(block);
return -1;
+ }
range->blocks[CTX_BLOCK_ID(reg[i + j].offset)] = block;
}