From 79b81f48402c1276d4cfd3bf0cbfb4084952b36b Mon Sep 17 00:00:00 2001 From: czach Date: Thu, 13 Mar 2014 11:05:50 +0100 Subject: [PATCH] Fixed potential SEGFAULT. --- src/socket_base.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/socket_base.cpp b/src/socket_base.cpp index d6ac22d1..111f5c8e 100644 --- a/src/socket_base.cpp +++ b/src/socket_base.cpp @@ -121,10 +121,13 @@ zmq::socket_base_t *zmq::socket_base_t::create (int type_, class ctx_t *parent_, errno = EINVAL; return NULL; } - alloc_assert (s); - if (s->mailbox.get_fd () == retired_fd) + + if (s->mailbox.get_fd () == -1) + { + delete s; return NULL; + } return s; }