3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-06 15:25:46 +00:00

API: dont deref already free'd memory on error

This commit is contained in:
Nuno Lopes 2020-06-30 15:04:40 +01:00
parent 64f1a759a7
commit 8fda4f904d
7 changed files with 24 additions and 14 deletions

View file

@ -147,6 +147,14 @@ namespace api {
}
}
void context::set_error_code(Z3_error_code err, std::string &&opt_msg) {
m_error_code = err;
if (err != Z3_OK) {
m_exception_msg = std::move(opt_msg);
invoke_error_handler(err);
}
}
void context::check_searching() {
if (m_searching) {
set_error_code(Z3_INVALID_USAGE, "cannot use function while searching"); // TBD: error code could be fixed.
@ -287,7 +295,8 @@ namespace api {
buffer << mk_bounded_pp(a->get_arg(i), m(), 3) << " of sort ";
buffer << mk_pp(m().get_sort(a->get_arg(i)), m()) << "\n";
}
warning_msg("%s",buffer.str().c_str());
auto str = buffer.str();
warning_msg("%s", str.c_str());
break;
}
case AST_VAR: