Memory leak fix Early returns were erroneous and were causing memory leaks Change-Id: Ifd6e37d79b6abd3f7d8d8899c951f1a0b4a66fb0 Reviewed-on: https://swiftshader-review.googlesource.com/19588 Reviewed-by: Nicolas Capens <nicolascapens@google.com> Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Reactor/Optimizer.cpp b/src/Reactor/Optimizer.cpp index 15c5f84..aac8c04 100644 --- a/src/Reactor/Optimizer.cpp +++ b/src/Reactor/Optimizer.cpp
@@ -150,14 +150,14 @@ if(!llvm::isa<Ice::InstAlloca>(alloca)) { - return; // Allocas are all at the top + break; // Allocas are all at the top } Ice::Operand *address = alloca.getDest(); if(!hasUses(address)) { - return; + continue; } const auto &addressUses = *getUses(address); @@ -213,14 +213,14 @@ if(!llvm::isa<Ice::InstAlloca>(alloca)) { - return; // Allocas are all at the top + break; // Allocas are all at the top } Ice::Operand *address = alloca.getDest(); if(!hasUses(address)) { - return; + continue; } auto &addressUses = *getUses(address); @@ -324,14 +324,14 @@ if(!llvm::isa<Ice::InstAlloca>(alloca)) { - return; // Allocas are all at the top + break; // Allocas are all at the top } Ice::Operand *address = alloca.getDest(); if(!hasUses(address)) { - return; + continue; } const auto &addressUses = *getUses(address);