Commit 213254cc authored by Simon Giesecke's avatar Simon Giesecke

Problem: inconsistent behaviour of zmq_poller_new in case of memory exhaustion

Solution: return NULL and set errno to ENOMEM
parent 2cd147e5
...@@ -1167,7 +1167,9 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) ...@@ -1167,7 +1167,9 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
void *zmq_poller_new (void) void *zmq_poller_new (void)
{ {
zmq::socket_poller_t *poller = new (std::nothrow) zmq::socket_poller_t; zmq::socket_poller_t *poller = new (std::nothrow) zmq::socket_poller_t;
alloc_assert (poller); if (!poller) {
errno = ENOMEM;
}
return poller; return poller;
} }
...@@ -1295,7 +1297,6 @@ int zmq_poller_remove_fd (void *poller_, int fd_) ...@@ -1295,7 +1297,6 @@ int zmq_poller_remove_fd (void *poller_, int fd_)
return ((zmq::socket_poller_t *) poller_)->remove_fd (fd_); return ((zmq::socket_poller_t *) poller_)->remove_fd (fd_);
} }
int zmq_poller_wait (void *poller_, zmq_poller_event_t *event_, long timeout_) int zmq_poller_wait (void *poller_, zmq_poller_event_t *event_, long timeout_)
{ {
if (!poller_ || !((zmq::socket_poller_t *) poller_)->check_tag ()) { if (!poller_ || !((zmq::socket_poller_t *) poller_)->check_tag ()) {
......
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