From aaf98840642fac6bdb59dcc444829bf2d7ae81be Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Thu, 11 Dec 2014 21:54:21 +0200 Subject: [PATCH] circular_buffer: fix pop_front(), pop_back() These methods should destroy the objects they are popping. We probably haven't seen any leaks since we usually move() the item before popping it. --- core/circular_buffer.hh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/circular_buffer.hh b/core/circular_buffer.hh index 9cf2bdb99a..02a6bdc5fe 100644 --- a/core/circular_buffer.hh +++ b/core/circular_buffer.hh @@ -281,6 +281,7 @@ template inline void circular_buffer::pop_front() { + _impl.destroy(&front()); ++_impl.begin; if (_impl.begin == _impl.storage + _impl.capacity) { _impl.begin = _impl.storage; @@ -292,6 +293,7 @@ template inline void circular_buffer::pop_back() { + _impl.destroy(&back()); if (_impl.end == _impl.begin) { _impl.end = _impl.storage + _impl.capacity; }