Fix potential segmentation fault

Call the allocation assertion macro before dereferencing the socket
pointer.
This commit is contained in:
Alex Pyrgiotis
2014-02-03 17:35:53 +02:00
parent 0ac223c746
commit e6ef16d005

View File

@@ -121,10 +121,11 @@ 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)
return NULL;
alloc_assert (s);
return s;
}