diff options
author | Darren Tucker <dtucker@cvs.openbsd.org> | 2019-05-03 04:11:01 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@cvs.openbsd.org> | 2019-05-03 04:11:01 +0000 |
commit | edcc5784ada9e16ad75f0292c718b647d7c2cec5 (patch) | |
tree | 39cd30319cc33551628f56dea23f25c8eb5acaf1 /usr.bin | |
parent | f73e88095095918e93114a3b18b0d4e04956310a (diff) |
Free channel objects on exit path. Patch from markus at blueflash.cc,
ok deraadt
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/channels.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/usr.bin/ssh/channels.c b/usr.bin/ssh/channels.c index 5556d975143..e8bb75028df 100644 --- a/usr.bin/ssh/channels.c +++ b/usr.bin/ssh/channels.c @@ -1,4 +1,4 @@ -/* $OpenBSD: channels.c,v 1.389 2019/01/19 21:37:13 djm Exp $ */ +/* $OpenBSD: channels.c,v 1.390 2019/05/03 04:11:00 dtucker Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -629,10 +629,30 @@ void channel_free_all(struct ssh *ssh) { u_int i; + struct ssh_channels *sc = ssh->chanctxt; - for (i = 0; i < ssh->chanctxt->channels_alloc; i++) - if (ssh->chanctxt->channels[i] != NULL) - channel_free(ssh, ssh->chanctxt->channels[i]); + for (i = 0; i < sc->channels_alloc; i++) + if (sc->channels[i] != NULL) + channel_free(ssh, sc->channels[i]); + + free(sc->channels); + sc->channels = NULL; + sc->channels_alloc = 0; + sc->channel_max_fd = 0; + + free(sc->x11_saved_display); + sc->x11_saved_display = NULL; + + free(sc->x11_saved_proto); + sc->x11_saved_proto = NULL; + + free(sc->x11_saved_data); + sc->x11_saved_data = NULL; + sc->x11_saved_data_len = 0; + + free(sc->x11_fake_data); + sc->x11_fake_data = NULL; + sc->x11_fake_data_len = 0; } /* |