From ffc33ca28cb4a409766349b5a3792727fb7689a8 Mon Sep 17 00:00:00 2001 From: Jon Simons Date: Wed, 30 Oct 2013 18:18:32 -0700 Subject: 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 --- src/poll.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/poll.c b/src/poll.c index bde0198..8e21e0d 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); -- cgit