[Mesa-dev] [PATCH] tgsi: Fix memory leak in out-of-memory path.
Brian Paul
brianp at vmware.com
Tue Oct 25 10:33:25 PDT 2011
On 10/25/2011 09:26 AM, Vinson Lee wrote:
> Fixes Coverity resource leak defect.
> ---
> 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 b4eea54..1fb7f8f 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;
Reviewed-by: Brian Paul <brianp at vmware.com>
More information about the mesa-dev
mailing list