diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2012-10-05 10:46:08 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2012-10-05 11:12:13 +0200 |
commit | 332f1a2a519508a6c7def7d4b645b5a3759ba13a (patch) | |
tree | 4873048ed1bc35facaf8e02c553fd4b0c05387f8 /src | |
parent | 213321d706665b42a5aa0b981958537e5dbe0a38 (diff) | |
download | libssh-332f1a2a519508a6c7def7d4b645b5a3759ba13a.tar.gz libssh-332f1a2a519508a6c7def7d4b645b5a3759ba13a.tar.xz libssh-332f1a2a519508a6c7def7d4b645b5a3759ba13a.zip |
channels: Fix a memory leak in ssh_channel_select().
Diffstat (limited to 'src')
-rw-r--r-- | src/channels.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/channels.c b/src/channels.c index b9f5f21..0e63ef2 100644 --- a/src/channels.c +++ b/src/channels.c @@ -3046,10 +3046,14 @@ int ssh_channel_select(ssh_channel *readchans, ssh_channel *writechans, break; } /* Add all channels' sessions right into an event object */ - if (!event){ + if (event == NULL) { event = ssh_event_new(); - if(!event){ - return SSH_ERROR; + if (event == NULL) { + SAFE_FREE(rchans); + SAFE_FREE(wchans); + SAFE_FREE(echans); + + return SSH_ERROR; } for (i = 0; readchans[i] != NULL; i++) { ssh_poll_get_default_ctx(readchans[i]->session); |