Memory leak in zmq_recv fixed

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
This commit is contained in:
Martin Sustrik 2011-03-26 11:05:55 +01:00
parent abb184a051
commit 82dbef360c

View File

@ -384,6 +384,10 @@ int zmq_recv (void *s_, void *buf_, size_t len_, int flags_)
// TODO: Build in a notification mechanism to report the overflows.
size_t to_copy = size_t (rc) < len_ ? size_t (rc) : len_;
memcpy (buf_, zmq_msg_data (&msg), to_copy);
rc = zmq_msg_close (&msg);
errno_assert (rc == 0);
return (int) to_copy;
}