mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-23 16:48:08 +02:00
Fix memory leak when creating a socket fails.
Previously, AddressSanitizer flagged leaks when running tests/test_many_sockets.cpp.
This commit is contained in:
@@ -154,8 +154,11 @@ zmq::socket_base_t *zmq::socket_base_t::create (int type_, class ctx_t *parent_,
|
||||
|
||||
mailbox_t *mailbox = dynamic_cast<mailbox_t*> (s->mailbox);
|
||||
|
||||
if (mailbox != NULL && mailbox->get_fd () == retired_fd)
|
||||
if (mailbox != NULL && mailbox->get_fd () == retired_fd) {
|
||||
s->destroyed = true;
|
||||
delete s;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
Reference in New Issue
Block a user