summaryrefslogtreecommitdiffstats
path: root/src/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/client.c')
-rw-r--r--src/client.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/client.c b/src/client.c
index c7f33a5..209524c 100644
--- a/src/client.c
+++ b/src/client.c
@@ -732,6 +732,7 @@ int ssh_get_openssh_version(ssh_session session) {
*/
void ssh_disconnect(ssh_session session) {
ssh_string str = NULL;
+ struct ssh_iterator *it;
int i;
if (session == NULL) {
@@ -770,8 +771,10 @@ error:
}
session->fd = SSH_INVALID_SOCKET;
session->session_state=SSH_SESSION_STATE_DISCONNECTED;
- while (session->channels) {
- ssh_channel_free(session->channels);
+
+ while ((it=ssh_list_get_iterator(session->channels)) != NULL) {
+ ssh_channel_free(ssh_iterator_value(ssh_channel,it));
+ ssh_list_remove(session->channels, it);
}
if(session->current_crypto){
crypto_free(session->current_crypto);