glsl_to_tgsi: Fix potential leak
authorErnestas Kulik <ernestas.kulik@gmail.com>
Thu, 30 Aug 2018 16:02:44 +0000 (19:02 +0300)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 4 Sep 2018 18:01:43 +0000 (14:01 -0400)
Reported by Coverity: arr_live_ranges is freed in a different branch
than the one in which it was allocated.

Signed-off-by: Ernestas Kulik <ernestas.kulik@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index 7b96947c607e452fe1feb6a4725212c23a4e998a..68573f628db84f7a119af3a40705095d17368c73 100644 (file)
@@ -5616,10 +5616,11 @@ glsl_to_tgsi_visitor::merge_registers(void)
 
       this->next_array =  merge_arrays(this->next_array, this->array_sizes,
                                       &this->instructions, arr_live_ranges);
-
-      if (arr_live_ranges)
-        delete[] arr_live_ranges;
    }
+
+   if (arr_live_ranges)
+      delete[] arr_live_ranges;
+
    ralloc_free(reg_live_ranges);
 }