mirror of
https://github.com/zeromq/libzmq.git
synced 2025-02-23 07:12:47 +01:00
Problem: deallocate calls release after de-allocation
Solution: reduce to newly extracted function clear, which does not use the freed pointer
This commit is contained in:
parent
e37fc47fb6
commit
22b72bb678
@ -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 ()
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user