mirror of https://github.com/getdnsapi/getdns.git
Off by one problem?
This commit is contained in:
parent
3e8822e0e2
commit
b7c2e53a82
|
@ -315,12 +315,16 @@ poll_eventloop_run_once(getdns_eventloop *loop, int blocking)
|
|||
if ((timeout == TIMEOUT_FOREVER) && (num_pfds == 0))
|
||||
return;
|
||||
|
||||
if (num_pfds > poll_loop->pfds_capacity) {
|
||||
poll_loop->pfds_capacity = up_pow2(num_pfds);
|
||||
if (num_pfds >= poll_loop->pfds_capacity) {
|
||||
poll_loop->pfds_capacity = up_pow2(num_pfds + 1);
|
||||
if (poll_loop->pfds) {
|
||||
poll_loop->pfds = GETDNS_XMALLOC(poll_loop->mf, struct pollfd, poll_loop->pfds_capacity);
|
||||
} else
|
||||
poll_loop->pfds = GETDNS_XREALLOC(poll_loop->mf, poll_loop->pfds, struct pollfd, poll_loop->pfds_capacity);
|
||||
if (poll_loop->pfds == 0) {
|
||||
poll_loop->pfds_capacity = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
HASH_ITER(hh, poll_loop->fd_events, s, tmp) {
|
||||
|
|
Loading…
Reference in New Issue