softpipe: avoid leaking local_mem on machines alloc failure
authorIlia Mirkin <imirkin@alum.mit.edu>
Sun, 1 May 2016 02:31:26 +0000 (22:31 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sun, 1 May 2016 15:19:08 +0000 (11:19 -0400)
Spotted by Coverity

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Vinson Lee <vlee@freedesktop.org>
src/gallium/drivers/softpipe/sp_compute.c

index d5b5913f6a23ee2b07d79eee93b1f4636eae3d94..53f7a0beb7719061ca39bb4001c5ff7aabf105cb 100644 (file)
@@ -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++) {