From 774f6fc334c46739e979a9026bf1efdabdb4660c Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Sun, 24 May 2020 19:48:03 -0700 Subject: [PATCH] [kutil] Don't use `delete` on non-`new` pointers `kutil::vector` was calling `operator delete []` on memory that had not been allocated with `operator new []`, and so was deleting the wrong pointer. Tags: bug memory allocator --- src/libraries/kutil/include/kutil/vector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/kutil/include/kutil/vector.h b/src/libraries/kutil/include/kutil/vector.h index 8522cd8..441dbc5 100644 --- a/src/libraries/kutil/include/kutil/vector.h +++ b/src/libraries/kutil/include/kutil/vector.h @@ -61,7 +61,7 @@ public: ~vector() { while (m_size) remove(); - delete [] m_elements; + m_alloc.free(m_elements); } /// Get the size of the array.