From ab5c8c8deaf22e813f32c488ed4cdb0d9e7e21c0 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Sat, 24 Sep 2016 18:57:59 +0100 Subject: [PATCH] Problem: zmq_ctx_term segfaults with too many pending inproc connects Solution: add a zmq_assert to check if the ephemeral sockets created to drain the queue of pending inproc connecting sockets was allocated successfully. --- src/ctx.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ctx.cpp b/src/ctx.cpp index bd798eb0..b2d70d56 100644 --- a/src/ctx.cpp +++ b/src/ctx.cpp @@ -152,6 +152,8 @@ int zmq::ctx_t::terminate () pending_connections_t copy = pending_connections; for (pending_connections_t::iterator p = copy.begin (); p != copy.end (); ++p) { zmq::socket_base_t *s = create_socket (ZMQ_PAIR); + // create_socket might fail eg: out of memory/sockets limit reached + zmq_assert (s); s->bind (p->first.c_str ()); s->close (); }