aboutsummaryrefslogtreecommitdiff
path: root/src/poll.c
diff options
context:
space:
mode:
authorJon Simons <jon@jonsimons.org>2013-10-30 18:18:32 -0700
committerAndreas Schneider <asn@cryptomilk.org>2013-10-31 11:55:09 +0100
commitffc33ca28cb4a409766349b5a3792727fb7689a8 (patch)
tree089ed140f3cdfca0905642e0d4baaece5bde62d2 /src/poll.c
parentee95c05c086db4525c7cf136f0bdf7c45192e734 (diff)
downloadlibssh-ffc33ca28cb4a409766349b5a3792727fb7689a8.tar.gz
libssh-ffc33ca28cb4a409766349b5a3792727fb7689a8.tar.xz
libssh-ffc33ca28cb4a409766349b5a3792727fb7689a8.zip
poll: fix leak in ssh_poll_ctx_free
Fix a memory leak in 'ssh_poll_ctx_free': issue 'ssh_poll_free' to remove the poll handle from its context and free it. BUG: https://red.libssh.org/issues/128 Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/poll.c')
-rw-r--r--src/poll.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/poll.c b/src/poll.c
index bde0198d..8e21e0d5 100644
--- a/src/poll.c
+++ b/src/poll.c
@@ -450,7 +450,11 @@ void ssh_poll_ctx_free(ssh_poll_ctx ctx) {
if (ctx->polls_allocated > 0) {
while (ctx->polls_used > 0){
ssh_poll_handle p = ctx->pollptrs[0];
- ssh_poll_ctx_remove(ctx, p);
+ /*
+ * The free function calls ssh_poll_ctx_remove() and decrements
+ * ctx->polls_used
+ */
+ ssh_poll_free(p);
}
SAFE_FREE(ctx->pollptrs);