aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormilo <milo@r0ot.me>2011-04-20 04:09:28 +0200
committermilo <milo@r0ot.me>2011-05-02 16:58:40 +0200
commit809254160308289fdcddf8a5eabad0c85a35bce7 (patch)
tree5c1cc21b2d43db2f9895b6f4574c21f6bb66ab13 /src
parent7ba09388464f0437da2833b81e268744b20a68fe (diff)
downloadlibssh-809254160308289fdcddf8a5eabad0c85a35bce7.tar.gz
libssh-809254160308289fdcddf8a5eabad0c85a35bce7.tar.xz
libssh-809254160308289fdcddf8a5eabad0c85a35bce7.zip
[poll] avoid infinite loop in ssh_poll_ctx_free()
(cherry picked from commit eace59d3eaad413fd846d1c8b4c926285f6cd5ab)
Diffstat (limited to 'src')
-rw-r--r--src/poll.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/poll.c b/src/poll.c
index ed2924c6..48991e9c 100644
--- a/src/poll.c
+++ b/src/poll.c
@@ -495,7 +495,12 @@ void ssh_poll_ctx_free(ssh_poll_ctx ctx) {
/* force poll object removal */
if (p->cb && p->cb(p, fd, POLLERR, p->cb_data) < 0) {
- used = ctx->polls_used;
+ if(ctx->polls_used < used) {
+ used = ctx->polls_used;
+ } else {
+ /* nothing to do */
+ i++;
+ }
} else {
i++;
}