summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpp/unpack.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/cpp/unpack.cpp b/cpp/unpack.cpp
index cbf1356..ea4d414 100644
--- a/cpp/unpack.cpp
+++ b/cpp/unpack.cpp
@@ -198,7 +198,7 @@ void unpacker::expand_buffer(size_t len)
{
if(m_off == 0) {
size_t next_size;
- if(m_free != 0) { next_size = m_free * 2; }
+ if(m_used != 0) { next_size = (m_used + m_free) * 2; }
else { next_size = UNPACKER_INITIAL_BUFFER_SIZE; }
while(next_size < len + m_used) { next_size *= 2; }