mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-28 16:15:23 +08:00
honor buffer reference count in zmq::shared_message_memory_allocator::deallocate
This commit is contained in:
parent
f1e6cb8ba9
commit
06e882f8ea
@ -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 ()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user