0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-28 07:58:14 +08:00

honor buffer reference count in zmq::shared_message_memory_allocator::deallocate

This commit is contained in:
Max Kozlovsky 2015-10-19 13:29:26 -07:00
parent f1e6cb8ba9
commit 06e882f8ea

View File

@ -96,10 +96,11 @@ unsigned char* zmq::shared_message_memory_allocator::allocate ()
void zmq::shared_message_memory_allocator::deallocate ()
{
std::free (buf);
buf = NULL;
bufsize = 0;
msg_refcnt = NULL;
zmq::atomic_counter_t* c = reinterpret_cast<zmq::atomic_counter_t* >(buf);
if (buf && !c->sub(1)) {
std::free(buf);
}
release();
}
unsigned char* zmq::shared_message_memory_allocator::release ()