1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-05-31 16:21:13 +03:00

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>
This commit is contained in:
Jon Simons 2013-12-09 11:24:45 -08:00 committed by Andreas Schneider
parent 0557f57c63
commit 20b5734649

View File

@ -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.