Commit 2e55bc58 authored by Luca Boccassi's avatar Luca Boccassi Committed by GitHub

Merge pull request #2125 from GreatFruitOmsk/master

Fix fd_entry may reference invalid object.
parents 22dac194 06614a39
......@@ -353,29 +353,27 @@ void zmq::select_t::loop ()
// Size is cached to avoid iteration through just added descriptors.
for (fd_entries_t::size_type i = 0, size = fd_entries.size (); i < size && rc > 0; ++i) {
fd_entry_t& fd_entry = fd_entries [i];
if (fd_entry.fd == retired_fd)
if (fd_entries [i].fd == retired_fd)
continue;
if (FD_ISSET (fd_entry.fd, &local_fds_set.read)) {
fd_entry.events->in_event ();
if (FD_ISSET (fd_entries [i].fd, &local_fds_set.read)) {
fd_entries [i].events->in_event ();
--rc;
}
if (fd_entry.fd == retired_fd || rc == 0)
if (fd_entries [i].fd == retired_fd || rc == 0)
continue;
if (FD_ISSET (fd_entry.fd, &local_fds_set.write)) {
fd_entry.events->out_event ();
if (FD_ISSET (fd_entries [i].fd, &local_fds_set.write)) {
fd_entries [i].events->out_event ();
--rc;
}
if (fd_entry.fd == retired_fd || rc == 0)
if (fd_entries [i].fd == retired_fd || rc == 0)
continue;
if (FD_ISSET (fd_entry.fd, &local_fds_set.error)) {
fd_entry.events->in_event ();
if (FD_ISSET (fd_entries [i].fd, &local_fds_set.error)) {
fd_entries [i].events->in_event ();
--rc;
}
}
......
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