mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
fix memory leak in SAT solver exposed by regression tests
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
da63ac809e
commit
aec5a38b14
10 changed files with 82 additions and 30 deletions
|
@ -78,8 +78,12 @@ namespace sat {
|
|||
clause_vector::iterator end = s.m_clauses.end();
|
||||
try {
|
||||
for (; it != end; ++it) {
|
||||
if (s.inconsistent())
|
||||
if (s.inconsistent()) {
|
||||
for (; it != end; ++it, ++it2) {
|
||||
*it2 = *it;
|
||||
}
|
||||
break;
|
||||
}
|
||||
SASSERT(s.m_qhead == s.m_trail.size());
|
||||
if (m_counter < limit || s.inconsistent()) {
|
||||
*it2 = *it;
|
||||
|
|
|
@ -169,6 +169,7 @@ namespace sat {
|
|||
#endif
|
||||
void * mem = m_allocator.allocate(size);
|
||||
clause * cls = new (mem) clause(m_id_gen.mk(), num_lits, lits, learned);
|
||||
TRACE("sat", tout << "alloc: " << cls->id() << " " << cls << " " << *cls << " " << (learned?"l":"a") << "\n";);
|
||||
SASSERT(!learned || cls->is_learned());
|
||||
return cls;
|
||||
}
|
||||
|
|
|
@ -461,6 +461,7 @@ namespace sat {
|
|||
}
|
||||
|
||||
void solver::dettach_clause(clause & c) {
|
||||
TRACE("sat", tout << c.id() << "\n";);
|
||||
if (c.size() == 3)
|
||||
dettach_ter_clause(c);
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue