Fix uninitialized data error in valgrind check

This commit is contained in:
Willem Toorop 2017-02-15 11:43:07 +01:00
parent c936f0c51d
commit 3e8822e0e2
1 changed files with 8 additions and 6 deletions

View File

@ -324,16 +324,18 @@ poll_eventloop_run_once(getdns_eventloop *loop, int blocking)
} }
i = 0; i = 0;
HASH_ITER(hh, poll_loop->fd_events, s, tmp) { HASH_ITER(hh, poll_loop->fd_events, s, tmp) {
if (s->event->read_cb) { if (!s->event->read_cb && !s->event->write_cb)
poll_loop->pfds[i].fd = s->id; continue;
poll_loop->pfds[i].fd = s->id;
poll_loop->pfds[i].events = 0;
poll_loop->pfds[i].revents = 0; /* <-- probably not needed */
if (s->event->read_cb)
poll_loop->pfds[i].events |= POLLIN; poll_loop->pfds[i].events |= POLLIN;
} if (s->event->write_cb)
if (s->event->write_cb) {
poll_loop->pfds[i].fd = s->id;
poll_loop->pfds[i].events |= POLLOUT; poll_loop->pfds[i].events |= POLLOUT;
}
i++; i++;
} }
assert(i == num_pfds);
if (timeout == TIMEOUT_FOREVER) { if (timeout == TIMEOUT_FOREVER) {
poll_timeout = -1; poll_timeout = -1;