mirror of
https://github.com/Z3Prover/z3
synced 2025-06-14 01:46:15 +00:00
fixed memory leak (`mem' remained allocated upon exception thrown in check_args).
This commit is contained in:
parent
2e071e89b0
commit
d2c9b69eb3
1 changed files with 61 additions and 52 deletions
|
@ -2002,10 +2002,12 @@ bool ast_manager::coercion_needed(func_decl * decl, unsigned num_args, expr * co
|
||||||
}
|
}
|
||||||
|
|
||||||
app * ast_manager::mk_app_core(func_decl * decl, unsigned num_args, expr * const * args) {
|
app * ast_manager::mk_app_core(func_decl * decl, unsigned num_args, expr * const * args) {
|
||||||
|
app * r = 0;
|
||||||
|
app * new_node = 0;
|
||||||
unsigned sz = app::get_obj_size(num_args);
|
unsigned sz = app::get_obj_size(num_args);
|
||||||
void * mem = allocate_node(sz);
|
void * mem = allocate_node(sz);
|
||||||
app * new_node;
|
|
||||||
app * r;
|
try {
|
||||||
if (m_int_real_coercions && coercion_needed(decl, num_args, args)) {
|
if (m_int_real_coercions && coercion_needed(decl, num_args, args)) {
|
||||||
expr_ref_buffer new_args(*this);
|
expr_ref_buffer new_args(*this);
|
||||||
if (decl->is_associative()) {
|
if (decl->is_associative()) {
|
||||||
|
@ -2053,15 +2055,22 @@ app * ast_manager::mk_app_core(func_decl * decl, unsigned num_args, expr * const
|
||||||
*m_trace_stream << "[mk-app] #" << r->get_id() << " ";
|
*m_trace_stream << "[mk-app] #" << r->get_id() << " ";
|
||||||
if (r->get_num_args() == 0 && r->get_decl()->get_name() == "int") {
|
if (r->get_num_args() == 0 && r->get_decl()->get_name() == "int") {
|
||||||
ast_ll_pp(*m_trace_stream, *this, r);
|
ast_ll_pp(*m_trace_stream, *this, r);
|
||||||
} else if (is_label_lit(r)) {
|
}
|
||||||
|
else if (is_label_lit(r)) {
|
||||||
ast_ll_pp(*m_trace_stream, *this, r);
|
ast_ll_pp(*m_trace_stream, *this, r);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
*m_trace_stream << r->get_decl()->get_name();
|
*m_trace_stream << r->get_decl()->get_name();
|
||||||
for (unsigned i = 0; i < r->get_num_args(); i++)
|
for (unsigned i = 0; i < r->get_num_args(); i++)
|
||||||
*m_trace_stream << " #" << r->get_arg(i)->get_id();
|
*m_trace_stream << " #" << r->get_arg(i)->get_id();
|
||||||
*m_trace_stream << "\n";
|
*m_trace_stream << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
deallocate_node(static_cast<ast*>(mem), sz);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue