mirror of
https://github.com/Z3Prover/z3
synced 2025-06-20 12:53:38 +00:00
vector: make expand_vector() less prone to mem leaks by calling the destructors after move
This commit is contained in:
parent
e7f0f3b834
commit
d18e975a49
1 changed files with 1 additions and 0 deletions
|
@ -91,6 +91,7 @@ class vector {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (auto I = old_data; I != old_data + old_size; ++I) {
|
for (auto I = old_data; I != old_data + old_size; ++I) {
|
||||||
new (&m_data[i++]) T(std::move(*I));
|
new (&m_data[i++]) T(std::move(*I));
|
||||||
|
I->~T();
|
||||||
}
|
}
|
||||||
memory::deallocate(old_mem);
|
memory::deallocate(old_mem);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue