Fix potential memory leak

Delete the socket if the initialization part of the socket creation
fails.
This commit is contained in:
Alex Pyrgiotis
2014-02-03 18:03:25 +02:00
parent e6ef16d005
commit 50d34e5653

View File

@@ -123,8 +123,10 @@ zmq::socket_base_t *zmq::socket_base_t::create (int type_, class ctx_t *parent_,
}
alloc_assert (s);
if (s->mailbox.get_fd () == retired_fd)
if (s->mailbox.get_fd () == retired_fd) {
delete s;
return NULL;
}
return s;
}