Commit 979e6bb4 authored by Pieter Hintjens's avatar Pieter Hintjens

Merge pull request #1613 from maxkozlovsky/master

honor buffer reference count in zmq::shared_message_memory_allocator:…
parents f1e6cb8b 06e882f8
...@@ -96,10 +96,11 @@ unsigned char* zmq::shared_message_memory_allocator::allocate () ...@@ -96,10 +96,11 @@ unsigned char* zmq::shared_message_memory_allocator::allocate ()
void zmq::shared_message_memory_allocator::deallocate () void zmq::shared_message_memory_allocator::deallocate ()
{ {
std::free (buf); zmq::atomic_counter_t* c = reinterpret_cast<zmq::atomic_counter_t* >(buf);
buf = NULL; if (buf && !c->sub(1)) {
bufsize = 0; std::free(buf);
msg_refcnt = NULL; }
release();
} }
unsigned char* zmq::shared_message_memory_allocator::release () unsigned char* zmq::shared_message_memory_allocator::release ()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment