From 82dbef360c1fd5b20c8b59e1fc7273af14f55502 Mon Sep 17 00:00:00 2001
From: Martin Sustrik <sustrik@250bpm.com>
Date: Sat, 26 Mar 2011 11:05:55 +0100
Subject: Memory leak in zmq_recv fixed

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
---
 src/zmq.cpp | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'src')

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;    
 }
 
-- 
cgit v1.2.3