mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 18:55:10 +01:00
Problem: inconsistent behaviour of zmq_poller_add and zmq_poller_add_fd in case of memory exhaustion
Solution: always return -1 with errno == ENOMEM
This commit is contained in:
parent
0a037a7431
commit
00d25b7873
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user