diff options
author | Clifford Wolf <clifford@clifford.at> | 2014-07-25 13:07:31 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2014-07-25 13:24:10 +0200 |
commit | 309d64d46a7ca7390ccb27b06ecb78228c8b54f6 (patch) | |
tree | ae9a21d54d8228a8ab0c854ba3630b12e0b4acd7 /frontends | |
parent | 50f22ff30c921c90f686879455117c7c2c9f96d5 (diff) | |
download | yosys-309d64d46a7ca7390ccb27b06ecb78228c8b54f6.tar.gz yosys-309d64d46a7ca7390ccb27b06ecb78228c8b54f6.tar.bz2 yosys-309d64d46a7ca7390ccb27b06ecb78228c8b54f6.zip |
Fixed two memory leaks in ast simplify
Diffstat (limited to 'frontends')
-rw-r--r-- | frontends/ast/simplify.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc index d86bfb3f0..6302260a5 100644 --- a/frontends/ast/simplify.cc +++ b/frontends/ast/simplify.cc @@ -895,7 +895,10 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage, log_error("Expression in generate case at %s:%d is not constant!\n", filename.c_str(), linenum); } - if (RTLIL::const_eq(ref_value, buf->bitsAsConst(), ref_signed && buf->is_signed, ref_signed && buf->is_signed, 1).as_bool()) { + bool is_selected = RTLIL::const_eq(ref_value, buf->bitsAsConst(), ref_signed && buf->is_signed, ref_signed && buf->is_signed, 1).as_bool(); + delete buf; + + if (is_selected) { selected_case = this_genblock; i = children.size(); break; @@ -1301,6 +1304,8 @@ skip_dynamic_range_lvalue_expansion:; log_error("Failed to evaluate system function `%s' with non-constant value at %s:%d.\n", str.c_str(), filename.c_str(), linenum); RTLIL::Const arg_value = buf->bitsAsConst(); + delete buf; + uint32_t result = 0; for (size_t i = 0; i < arg_value.bits.size(); i++) if (arg_value.bits.at(i) == RTLIL::State::S1) |