[Mesa-dev] [PATCH] softpipe: avoid leaking local_mem on machines alloc failure

Vinson Lee vlee at freedesktop.org
Sun May 1 04:50:46 UTC 2016


On Sat, Apr 30, 2016 at 7:31 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> Spotted by Coverity
>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>  src/gallium/drivers/softpipe/sp_compute.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/softpipe/sp_compute.c b/src/gallium/drivers/softpipe/sp_compute.c
> index d5b5913..53f7a0b 100644
> --- a/src/gallium/drivers/softpipe/sp_compute.c
> +++ b/src/gallium/drivers/softpipe/sp_compute.c
> @@ -191,8 +191,10 @@ softpipe_launch_grid(struct pipe_context *context,
>     }
>
>     machines = CALLOC(sizeof(struct tgsi_exec_machine *), num_threads_in_group);
> -   if (!machines)
> +   if (!machines) {
> +      FREE(local_mem);
>        return;
> +   }
>
>     /* initialise machines + GRID_SIZE + THREAD_ID  + BLOCK_SIZE */
>     for (d = 0; d < bdepth; d++) {
> --
> 2.7.3
>

Reviewed-by: Vinson Lee <vlee at freedesktop.org>


More information about the mesa-dev mailing list