Skip to content

Commit d88414e

Browse files
committed
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.
1 parent 37275e7 commit d88414e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

zmq.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,9 +506,12 @@ namespace zmq
506506
#endif
507507

508508
#ifdef ZMQ_HAS_RVALUE_REFS
509-
inline socket_t(socket_t&& rhs) ZMQ_NOTHROW : ptr(rhs.ptr)
509+
inline socket_t(socket_t&& rhs) ZMQ_NOTHROW :
510+
ptr(rhs.ptr),
511+
ctxptr(rhs.ctxptr)
510512
{
511-
rhs.ptr = NULL;
513+
rhs.ptr = NULL;
514+
rhs.ctxptr = NULL;
512515
}
513516
inline socket_t& operator=(socket_t&& rhs) ZMQ_NOTHROW
514517
{

0 commit comments

Comments
 (0)