Commit 50d34e56 authored by Alex Pyrgiotis's avatar Alex Pyrgiotis

Fix potential memory leak

Delete the socket if the initialization part of the socket creation
fails.
parent e6ef16d0
...@@ -123,8 +123,10 @@ zmq::socket_base_t *zmq::socket_base_t::create (int type_, class ctx_t *parent_, ...@@ -123,8 +123,10 @@ zmq::socket_base_t *zmq::socket_base_t::create (int type_, class ctx_t *parent_,
} }
alloc_assert (s); alloc_assert (s);
if (s->mailbox.get_fd () == retired_fd) if (s->mailbox.get_fd () == retired_fd) {
delete s;
return NULL; return NULL;
}
return s; return s;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment