From 6436bc51e694dbaa8a270d7ee13b7677f8c8d098 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Thu, 30 Mar 2017 14:06:39 -0700 Subject: [PATCH] Problem: sub.xsetsockopt leaks message (0..n bytes) payload on fail. --- src/sub.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/sub.cpp b/src/sub.cpp index 4ff07346..e8718e58 100644 --- a/src/sub.cpp +++ b/src/sub.cpp @@ -69,15 +69,8 @@ int zmq::sub_t::xsetsockopt (int option_, const void *optval_, memcpy (data + 1, optval_, optvallen_); } // Pass it further on in the stack. - int err = 0; rc = xsub_t::xsend (&msg); - if (rc != 0) - err = errno; - int rc2 = msg.close (); - errno_assert (rc2 == 0); - if (rc != 0) - errno = err; - return rc; + return close_and_return (&msg, rc); } int zmq::sub_t::xsend (msg_t *)