aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Simons <jon@jonsimons.org>2013-12-09 11:24:45 -0800
committerAndreas Schneider <asn@cryptomilk.org>2013-12-11 21:03:45 +0100
commita633deb9854238a1c0ccd05c516b526f327545e8 (patch)
tree41604ac9be994cf54402188045d7d00cbd52d2ae
parent50b9a182f52c38c877b60b781077d33061a78c7d (diff)
downloadlibssh-a633deb9854238a1c0ccd05c516b526f327545e8.tar.gz
libssh-a633deb9854238a1c0ccd05c516b526f327545e8.tar.xz
libssh-a633deb9854238a1c0ccd05c516b526f327545e8.zip
channel: fix setting of channel->flags
Fix the setting of 'channel->flags' to use '|='. Before this change, one bug symptom can be that channels are never fully free'd via ssh_channel_free, resulting in memory leaks. Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--src/channels.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/channels.c b/src/channels.c
index a9226ddb..a6ac2be9 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -177,7 +177,7 @@ SSH_PACKET_CALLBACK(ssh_packet_channel_open_conf){
(long unsigned int) channel->remote_maxpacket);
channel->state = SSH_CHANNEL_STATE_OPEN;
- channel->flags = channel->flags & ~SSH_CHANNEL_FLAG_NOT_BOUND;
+ channel->flags &= ~SSH_CHANNEL_FLAG_NOT_BOUND;
return SSH_PACKET_USED;
}
@@ -635,7 +635,7 @@ SSH_PACKET_CALLBACK(channel_rcv_close) {
channel,
channel->callbacks->userdata);
}
- channel->flags &= SSH_CHANNEL_FLAG_CLOSED_REMOTE;
+ channel->flags |= SSH_CHANNEL_FLAG_CLOSED_REMOTE;
if(channel->flags & SSH_CHANNEL_FLAG_FREED_LOCAL)
ssh_channel_do_free(channel);
@@ -1078,7 +1078,7 @@ void ssh_channel_free(ssh_channel channel) {
if (session->alive && channel->state == SSH_CHANNEL_STATE_OPEN) {
ssh_channel_close(channel);
}
- channel->flags &= SSH_CHANNEL_FLAG_FREED_LOCAL;
+ channel->flags |= SSH_CHANNEL_FLAG_FREED_LOCAL;
/* The idea behind the flags is the following : it is well possible
* that a client closes a channel that stills exists on the server side.