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 () ...@@ -353,29 +353,27 @@ void zmq::select_t::loop ()
// Size is cached to avoid iteration through just added descriptors. // 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) { 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_entries [i].fd == retired_fd)
if (fd_entry.fd == retired_fd)
continue; continue;
if (FD_ISSET (fd_entry.fd, &local_fds_set.read)) { if (FD_ISSET (fd_entries [i].fd, &local_fds_set.read)) {
fd_entry.events->in_event (); fd_entries [i].events->in_event ();
--rc; --rc;
} }
if (fd_entry.fd == retired_fd || rc == 0) if (fd_entries [i].fd == retired_fd || rc == 0)
continue; continue;
if (FD_ISSET (fd_entry.fd, &local_fds_set.write)) { if (FD_ISSET (fd_entries [i].fd, &local_fds_set.write)) {
fd_entry.events->out_event (); fd_entries [i].events->out_event ();
--rc; --rc;
} }
if (fd_entry.fd == retired_fd || rc == 0) if (fd_entries [i].fd == retired_fd || rc == 0)
continue; continue;
if (FD_ISSET (fd_entry.fd, &local_fds_set.error)) { if (FD_ISSET (fd_entries [i].fd, &local_fds_set.error)) {
fd_entry.events->in_event (); fd_entries [i].events->in_event ();
--rc; --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