summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-03-26 11:05:55 +0100
committerMartin Sustrik <sustrik@250bpm.com>2011-03-26 11:05:55 +0100
commit82dbef360c1fd5b20c8b59e1fc7273af14f55502 (patch)
treed6791309b7248938440f6b5cfd836caafef40cfd
parentabb184a051b592b6d4c99fd3299e78ea7c1da826 (diff)
Memory leak in zmq_recv fixed
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
-rw-r--r--src/zmq.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/zmq.cpp b/src/zmq.cpp
index b533d23..399a426 100644
--- a/src/zmq.cpp
+++ b/src/zmq.cpp
@@ -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;
}