Commit ac9b05c3 authored by Martin Sustrik's avatar Martin Sustrik

Merge branch 'maint'

* maint:
  zmq_msg_move called on uninitialised message in xrep_t::xrecv -- fixed
parents 98fa2fa8 79aea5ff
...@@ -27,6 +27,7 @@ Martin Hurton <hurtonm@gmail.com> ...@@ -27,6 +27,7 @@ Martin Hurton <hurtonm@gmail.com>
Martin Lucina <mato@kotelna.sk> Martin Lucina <mato@kotelna.sk>
Martin Sustrik <sustrik@250bpm.com> Martin Sustrik <sustrik@250bpm.com>
Matus Hamorsky <mhamorsky@gmail.com> Matus Hamorsky <mhamorsky@gmail.com>
Max Wolf <YIDIEPXGXGPN@spammotel.com>
McClain Looney <m@loonsoft.com> McClain Looney <m@loonsoft.com>
Mikael Helbo Kjaer <mhk@designtech.dk> Mikael Helbo Kjaer <mhk@designtech.dk>
Pavel Gushcha <pavimus@gmail.com> Pavel Gushcha <pavimus@gmail.com>
......
...@@ -199,9 +199,7 @@ int zmq::xrep_t::xsend (zmq_msg_t *msg_, int flags_) ...@@ -199,9 +199,7 @@ int zmq::xrep_t::xsend (zmq_msg_t *msg_, int flags_)
int zmq::xrep_t::xrecv (zmq_msg_t *msg_, int flags_) int zmq::xrep_t::xrecv (zmq_msg_t *msg_, int flags_)
{ {
// Deallocate old content of the message. // If there is a prefetched message, return it.
zmq_msg_close (msg_);
if (prefetched) { if (prefetched) {
zmq_msg_move (msg_, &prefetched_msg); zmq_msg_move (msg_, &prefetched_msg);
more_in = msg_->flags & ZMQ_MSG_MORE; more_in = msg_->flags & ZMQ_MSG_MORE;
...@@ -209,6 +207,9 @@ int zmq::xrep_t::xrecv (zmq_msg_t *msg_, int flags_) ...@@ -209,6 +207,9 @@ int zmq::xrep_t::xrecv (zmq_msg_t *msg_, int flags_)
return 0; return 0;
} }
// Deallocate old content of the message.
zmq_msg_close (msg_);
// If we are in the middle of reading a message, just grab next part of it. // If we are in the middle of reading a message, just grab next part of it.
if (more_in) { if (more_in) {
zmq_assert (inpipes [current_in].active); zmq_assert (inpipes [current_in].active);
......
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