diff options
author | Vinson Lee <[email protected]> | 2011-10-25 08:23:02 -0700 |
---|---|---|
committer | Vinson Lee <[email protected]> | 2011-10-25 11:12:51 -0700 |
commit | 265f55e6273aafc8e7607cd70a4b9756f7cb6bff (patch) | |
tree | a2293a6618dd8d4420fbb7ea6f7e93c691f82ea1 | |
parent | c81b441ba2b8ab61d5e1f24ec7a34914c8a3b215 (diff) |
tgsi: Fix memory leak in out-of-memory path.
Fixes Coverity resource leak defect.
Reviewed-by: Brian Paul <[email protected]>
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_exec.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index b4eea546b73..1fb7f8f1898 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -674,16 +674,19 @@ tgsi_exec_machine_bind_shader( if (mach->Processor == TGSI_PROCESSOR_GEOMETRY && !mach->UsedGeometryShader) { - struct tgsi_exec_vector *inputs = - align_malloc(sizeof(struct tgsi_exec_vector) * - TGSI_MAX_PRIM_VERTICES * PIPE_MAX_ATTRIBS, - 16); - struct tgsi_exec_vector *outputs = - align_malloc(sizeof(struct tgsi_exec_vector) * - TGSI_MAX_TOTAL_VERTICES, 16); + struct tgsi_exec_vector *inputs; + struct tgsi_exec_vector *outputs; + + inputs = align_malloc(sizeof(struct tgsi_exec_vector) * + TGSI_MAX_PRIM_VERTICES * PIPE_MAX_ATTRIBS, + 16); if (!inputs) return; + + outputs = align_malloc(sizeof(struct tgsi_exec_vector) * + TGSI_MAX_TOTAL_VERTICES, 16); + if (!outputs) { align_free(inputs); return; |