diff --git a/libssh/channels.c b/libssh/channels.c index c881bd0a..c4e81680 100644 --- a/libssh/channels.c +++ b/libssh/channels.c @@ -2161,8 +2161,10 @@ int channel_poll(ssh_channel channel, int is_stderr){ } } - if (buffer_get_rest_len(stdbuf) > 0) - return buffer_get_rest_len(stdbuf); + if (buffer_get_rest_len(stdbuf) > 0){ + leave_function(); + return buffer_get_rest_len(stdbuf); + } if (channel->remote_eof) { leave_function();