3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-10-12 02:38:07 +00:00

Fix memory smash on double free of clauses

Signed-off-by: nikolajbjorner <nbjorner@microsoft.com>
This commit is contained in:
nikolajbjorner 2015-02-23 10:28:32 -08:00
parent a96a9a076d
commit 0d9f949ab2
6 changed files with 32 additions and 1 deletions

View file

@ -50,7 +50,10 @@ namespace sat {
}
solver::~solver() {
SASSERT(check_invariant());
TRACE("sat", tout << "Delete clauses\n";);
del_clauses(m_clauses.begin(), m_clauses.end());
TRACE("sat", tout << "Delete learned\n";);
del_clauses(m_learned.begin(), m_learned.end());
}
@ -1121,6 +1124,7 @@ namespace sat {
\brief GC (the second) half of the clauses in the database.
*/
void solver::gc_half(char const * st_name) {
TRACE("sat", tout << "gc\n";);
unsigned sz = m_learned.size();
unsigned new_sz = sz/2;
unsigned j = new_sz;
@ -1145,6 +1149,7 @@ namespace sat {
\brief Use gc based on dynamic psm. Clauses are initially frozen.
*/
void solver::gc_dyn_psm() {
TRACE("sat", tout << "gc\n";);
// To do gc at scope_lvl() > 0, I will need to use the reinitialization stack, or live with the fact
// that I may miss some propagations for reactivated clauses.
SASSERT(scope_lvl() == 0);