3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-29 03:45:51 +00:00

fix mem leak in buffer and remove copies in interval (#4458)

This commit is contained in:
Nuno Lopes 2020-06-03 10:26:00 +01:00
parent 04829e6b7a
commit 3d98bccc33
3 changed files with 6 additions and 16 deletions

View file

@ -43,6 +43,9 @@ protected:
T * new_buffer = reinterpret_cast<T*>(memory::allocate(sizeof(T) * new_capacity));
for (unsigned i = 0; i < m_pos; ++i) {
new (&new_buffer[i]) T(std::move(m_buffer[i]));
if (CallDestructors) {
m_buffer[i].~T();
}
}
free_memory();
m_buffer = new_buffer;