mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-31 01:43:02 +08:00
xsub: fix memory leak
The implementation of the send call for XSUB socket failed to release and initialise empty message when duplicate subscription was detected.
This commit is contained in:
parent
016df8e89c
commit
df5344bba0
14
src/xsub.cpp
14
src/xsub.cpp
@ -94,18 +94,18 @@ int zmq::xsub_t::xsend (msg_t *msg_, int flags_)
|
||||
if (*data == 1) {
|
||||
if (subscriptions.add (data + 1, size - 1))
|
||||
return dist.send_to_all (msg_, flags_);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
else if (*data == 0) {
|
||||
else {
|
||||
if (subscriptions.rm (data + 1, size - 1))
|
||||
return dist.send_to_all (msg_, flags_);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
zmq_assert (false);
|
||||
return -1;
|
||||
int rc = msg_->close ();
|
||||
errno_assert (rc == 0);
|
||||
rc = msg_->init ();
|
||||
errno_assert (rc == 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool zmq::xsub_t::xhas_out ()
|
||||
|
Loading…
x
Reference in New Issue
Block a user