diff --git a/src/decoder_allocators.cpp b/src/decoder_allocators.cpp index 78eac47d..6fcdfb71 100644 --- a/src/decoder_allocators.cpp +++ b/src/decoder_allocators.cpp @@ -108,17 +108,21 @@ void zmq::shared_message_memory_allocator::deallocate () if (buf && !c->sub (1)) { std::free (buf); } - release (); + clear (); } unsigned char *zmq::shared_message_memory_allocator::release () { unsigned char *b = buf; + clear (); + return b; +} + +void zmq::shared_message_memory_allocator::clear () +{ buf = NULL; bufsize = 0; msg_content = NULL; - - return b; } void zmq::shared_message_memory_allocator::inc_ref () diff --git a/src/decoder_allocators.hpp b/src/decoder_allocators.hpp index a47ac358..ab6398b5 100644 --- a/src/decoder_allocators.hpp +++ b/src/decoder_allocators.hpp @@ -120,6 +120,8 @@ class shared_message_memory_allocator void advance_content () { msg_content++; } private: + void clear (); + unsigned char *buf; std::size_t bufsize; const std::size_t max_size;