Commit 00d25b78 authored by Simon Giesecke's avatar Simon Giesecke

Problem: inconsistent behaviour of zmq_poller_add and zmq_poller_add_fd in case…

Problem: inconsistent behaviour of zmq_poller_add and zmq_poller_add_fd in case of memory exhaustion

Solution: always return -1 with errno == ENOMEM
parent 0a037a74
......@@ -137,7 +137,13 @@ int zmq::socket_poller_t::add (socket_base_t *socket_,
-1
#endif
};
items.push_back (item);
try {
items.push_back (item);
}
catch (const std::bad_alloc &) {
errno = ENOMEM;
return -1;
}
need_rebuild = true;
return 0;
......@@ -162,7 +168,13 @@ int zmq::socket_poller_t::add_fd (fd_t fd_, void *user_data_, short events_)
-1
#endif
};
items.push_back (item);
try {
items.push_back (item);
}
catch (const std::bad_alloc &) {
errno = ENOMEM;
return -1;
}
need_rebuild = true;
return 0;
......
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