summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-09-30 15:12:06 +0200
committerMartin Sustrik <sustrik@250bpm.com>2010-09-30 15:12:06 +0200
commitac9b05c36b9d1f5bb3f8465b4c56478c399a01f3 (patch)
treea2f757857b727fe9f4980d6f1f8fd8264c858a9b /src
parent98fa2fa802773252a2c569ffea99bce1c5f9cd4c (diff)
parent79aea5ffa61f969ec66205f7c9c8c1611a2fd8da (diff)
Merge branch 'maint'
* maint: zmq_msg_move called on uninitialised message in xrep_t::xrecv -- fixed
Diffstat (limited to 'src')
-rw-r--r--src/xrep.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/xrep.cpp b/src/xrep.cpp
index 68b9d1b..a6c3cf6 100644
--- a/src/xrep.cpp
+++ b/src/xrep.cpp
@@ -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_)
{
- // Deallocate old content of the message.
- zmq_msg_close (msg_);
-
+ // If there is a prefetched message, return it.
if (prefetched) {
zmq_msg_move (msg_, &prefetched_msg);
more_in = msg_->flags & ZMQ_MSG_MORE;
@@ -209,6 +207,9 @@ int zmq::xrep_t::xrecv (zmq_msg_t *msg_, int flags_)
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 (more_in) {
zmq_assert (inpipes [current_in].active);