From d88414e435b11b67f20ee426c667026dbb08a73d Mon Sep 17 00:00:00 2001 From: a4z Date: Mon, 3 Jul 2017 10:35:19 +0200 Subject: [PATCH] Problem: uninitialized context pointer in socket_t move constructor This can cause monitor_t to crash if used with a socket that was constructed via the move constructor. Solution: initialise the context pointer variable ctxptr in the move constructor. --- zmq.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/zmq.hpp b/zmq.hpp index 7f8ff6b..3a43228 100644 --- a/zmq.hpp +++ b/zmq.hpp @@ -506,9 +506,12 @@ namespace zmq #endif #ifdef ZMQ_HAS_RVALUE_REFS - inline socket_t(socket_t&& rhs) ZMQ_NOTHROW : ptr(rhs.ptr) + inline socket_t(socket_t&& rhs) ZMQ_NOTHROW : + ptr(rhs.ptr), + ctxptr(rhs.ctxptr) { - rhs.ptr = NULL; + rhs.ptr = NULL; + rhs.ctxptr = NULL; } inline socket_t& operator=(socket_t&& rhs) ZMQ_NOTHROW {