Module: Mesa
Branch: master
Commit: b7b4a14db5bf7101935ca003259b85e542c7a7bc
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b7b4a14db5bf7101935ca003259b85e542c7a7bc

Author: Nicolai Hähnle <[email protected]>
Date:   Wed Sep 13 18:08:22 2017 +0200

st/glsl_to_tgsi: fix theoretical memory leak

It can't *really* happen since we don't use subroutines.

CID: 1417491
Reviewed-by: Timothy Arceri <[email protected]>
Reviewed-By: Gert Wollny <[email protected]>

---

 src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp
index 374393bb86..76c198e165 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp
@@ -617,6 +617,7 @@ get_temp_registers_required_lifetimes(void *mem_ctx, 
exec_list *instructions,
    int if_id = 0;
    int switch_id = 0;
    bool is_at_end = false;
+   bool ok = true;
    int n_scopes = 1;
 
    /* Count scopes to allocate the needed space without the need for
@@ -758,7 +759,8 @@ get_temp_registers_required_lifetimes(void *mem_ctx, 
exec_list *instructions,
           * Since this is not done, we have to bail out here and signal
           * that no register merge will take place.
           */
-         return false;
+         ok = false;
+         goto out;
       default: {
          for (unsigned j = 0; j < num_inst_src_regs(inst); j++) {
             const st_src_reg& src = inst->src[j];
@@ -797,8 +799,9 @@ get_temp_registers_required_lifetimes(void *mem_ctx, 
exec_list *instructions,
    }
    RENAME_DEBUG(cerr << "==================================\n\n");
 
+out:
    delete[] acc;
-   return true;
+   return ok;
 }
 
 /* Find the next register between [start, end) that has a life time starting

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to