0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-27 07:31:03 +08:00

zmq_msg_move called on uninitialised message in xrep_t::xrecv -- fixed

This commit is contained in:
Max Wolf 2010-09-30 15:10:47 +02:00 committed by Martin Sustrik
parent c1deb226f4
commit 79aea5ffa6
2 changed files with 5 additions and 3 deletions

View File

@ -24,6 +24,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>

View File

@ -190,9 +190,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;
@ -200,6 +198,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);