nir: fix memleak in error path
authorEric Engestrom <eric.engestrom@intel.com>
Mon, 26 Aug 2019 14:33:31 +0000 (15:33 +0100)
committerEric Engestrom <eric.engestrom@intel.com>
Tue, 3 Sep 2019 23:31:53 +0000 (00:31 +0100)
Fixes: 2cf59861a8128a91bfdd ("nir: Add partial redundancy elimination for compares")
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/compiler/nir/nir_opt_comparison_pre.c

index 33295e5eea67837646a9dd160b63b6165a7bb80a..a74dfa8939a1500846dc0cdf13c5ad230b726aaa 100644 (file)
@@ -107,8 +107,10 @@ push_block(struct block_queue *bq)
 
    if (!u_vector_init(&bi->instructions,
                       sizeof(nir_alu_instr *),
-                      8 * sizeof(nir_alu_instr *)))
+                      8 * sizeof(nir_alu_instr *))) {
+      free(bi);
       return NULL;
+   }
 
    exec_list_push_tail(&bq->blocks, &bi->node);