diff options
author | milo <milo@r0ot.me> | 2011-04-20 04:09:28 +0200 |
---|---|---|
committer | milo <milo@r0ot.me> | 2011-05-02 17:39:28 +0200 |
commit | a03bb2fbf78c0c54325fb4591b098ef09abaa38a (patch) | |
tree | c90c0e8623a42e99d6b1b3dee4854ebf874e2c9f | |
parent | bb784ec6be1b15c1895d4ec6fb31e35bc29dec81 (diff) | |
download | libssh-a03bb2fbf78c0c54325fb4591b098ef09abaa38a.tar.gz libssh-a03bb2fbf78c0c54325fb4591b098ef09abaa38a.tar.xz libssh-a03bb2fbf78c0c54325fb4591b098ef09abaa38a.zip |
[poll] avoid infinite loop in ssh_poll_ctx_free()
(cherry picked from commit 809254160308289fdcddf8a5eabad0c85a35bce7)
-rw-r--r-- | src/poll.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -491,8 +491,13 @@ void ssh_poll_ctx_free(ssh_poll_ctx ctx) { socket_t fd = ctx->pollfds[i].fd; /* force poll object removal */ - if (p->cb(p, fd, POLLERR, p->cb_data) < 0) { - used = ctx->polls_used; + if (p->cb && p->cb(p, fd, POLLERR, p->cb_data) < 0) { + if(ctx->polls_used < used) { + used = ctx->polls_used; + } else { + /* nothing to do */ + i++; + } } else { i++; } |