summaryrefslogtreecommitdiffstats
path: root/src/session.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2011-09-02 13:46:10 +0300
committerAris Adamantiadis <aris@0xbadc0de.be>2011-09-02 13:46:10 +0300
commit6d8bb956c5caa48c2aba6713f067224650c3c1e1 (patch)
tree00ab42ac7c63dc6e030f844f93cfb58999477bb2 /src/session.c
parent3eece8ac0b107a7df8d95325ef17ed19d6429e75 (diff)
downloadlibssh-6d8bb956c5caa48c2aba6713f067224650c3c1e1.tar.gz
libssh-6d8bb956c5caa48c2aba6713f067224650c3c1e1.tar.xz
libssh-6d8bb956c5caa48c2aba6713f067224650c3c1e1.zip
channels: replaced bugged lists with ssh_list
cherry-picked from 0aef5f Conflicts: src/session.c
Diffstat (limited to 'src/session.c')
-rw-r--r--src/session.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/session.c b/src/session.c
index eddcd5f..94c2867 100644
--- a/src/session.c
+++ b/src/session.c
@@ -157,6 +157,7 @@ err:
*/
void ssh_free(ssh_session session) {
int i;
+ struct ssh_iterator *it;
if (session == NULL) {
return;
@@ -187,9 +188,12 @@ void ssh_free(ssh_session session) {
ssh_poll_ctx_free(session->default_poll_ctx);
}
/* delete all channels */
- 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);
}
+ ssh_list_free(session->channels);
+ session->channels=NULL;
#ifndef _WIN32
agent_free(session->agent);
#endif /* _WIN32 */