diff options
| author | Jon Simons <jon@jonsimons.org> | 2013-12-09 11:24:45 -0800 |
|---|---|---|
| committer | Andreas Schneider <asn@cryptomilk.org> | 2013-12-11 21:02:47 +0100 |
| commit | 20b5734649985f6916a611f43d8e063aa009038c (patch) | |
| tree | 6ceb59ad4e9c7f9f1f7a3ed54343b1f555a7dd45 /src | |
| parent | 0557f57c63539b98a60211c8a4b5b81a2f61c95e (diff) | |
| download | libssh-20b5734649985f6916a611f43d8e063aa009038c.tar.gz libssh-20b5734649985f6916a611f43d8e063aa009038c.tar.xz libssh-20b5734649985f6916a611f43d8e063aa009038c.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>
Diffstat (limited to 'src')
| -rw-r--r-- | src/channels.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/channels.c b/src/channels.c index ae977c0f..25d3ddb9 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. |
