From d18e975a492cdd45ad7aad59831148b02b0c9862 Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Sun, 15 Oct 2017 03:52:11 +0100 Subject: [PATCH] vector: make expand_vector() less prone to mem leaks by calling the destructors after move --- src/util/vector.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/vector.h b/src/util/vector.h index a925792eb..27de49c44 100644 --- a/src/util/vector.h +++ b/src/util/vector.h @@ -91,6 +91,7 @@ class vector { int i = 0; for (auto I = old_data; I != old_data + old_size; ++I) { new (&m_data[i++]) T(std::move(*I)); + I->~T(); } memory::deallocate(old_mem); }