[Mesa-dev] [PATCH 6/6] r600g: Fix memory leak.
Marek Olšák
maraeo at gmail.com
Fri Feb 1 05:54:23 PST 2013
Reviewed-by: Marek Olšák <maraeo at gmail.com>
Marek
On Fri, Feb 1, 2013 at 8:50 AM, Vinson Lee <vlee at freedesktop.org> wrote:
> Fixes resource leak defect reported by Coverity.
>
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
> src/gallium/drivers/r600/r600_hw_context.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
> index a89f230..ebcd682 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;
> }
> --
> 1.8.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list