diff options
author | dtucker@openbsd.org <dtucker@openbsd.org> | 2019-05-03 04:11:00 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2019-05-08 18:42:43 +1000 |
commit | 62be1ffe5ffc68cfaac183320503c00a8c72e0b1 (patch) | |
tree | 387132a9d2de8db8c81fccb7ae74f29ab91ce08b | |
parent | 1c554a5d94b9de6bd5374e2992a5662746cc39ba (diff) |
upstream: Free channel objects on exit path. Patch from markus at
blueflash.cc, ok deraadt
OpenBSD-Commit-ID: dbe4db381603909482211ffdd2b48abd72169117
-rw-r--r-- | channels.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/channels.c b/channels.c index 657381b80..07cb4f9a7 100644 --- a/channels.c +++ b/channels.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: channels.c,v 1.389 2019/01/19 21:37:13 djm Exp $ */ | 1 | /* $OpenBSD: channels.c,v 1.390 2019/05/03 04:11:00 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -639,10 +639,30 @@ void | |||
639 | channel_free_all(struct ssh *ssh) | 639 | channel_free_all(struct ssh *ssh) |
640 | { | 640 | { |
641 | u_int i; | 641 | u_int i; |
642 | struct ssh_channels *sc = ssh->chanctxt; | ||
642 | 643 | ||
643 | for (i = 0; i < ssh->chanctxt->channels_alloc; i++) | 644 | for (i = 0; i < sc->channels_alloc; i++) |
644 | if (ssh->chanctxt->channels[i] != NULL) | 645 | if (sc->channels[i] != NULL) |
645 | channel_free(ssh, ssh->chanctxt->channels[i]); | 646 | channel_free(ssh, sc->channels[i]); |
647 | |||
648 | free(sc->channels); | ||
649 | sc->channels = NULL; | ||
650 | sc->channels_alloc = 0; | ||
651 | sc->channel_max_fd = 0; | ||
652 | |||
653 | free(sc->x11_saved_display); | ||
654 | sc->x11_saved_display = NULL; | ||
655 | |||
656 | free(sc->x11_saved_proto); | ||
657 | sc->x11_saved_proto = NULL; | ||
658 | |||
659 | free(sc->x11_saved_data); | ||
660 | sc->x11_saved_data = NULL; | ||
661 | sc->x11_saved_data_len = 0; | ||
662 | |||
663 | free(sc->x11_fake_data); | ||
664 | sc->x11_fake_data = NULL; | ||
665 | sc->x11_fake_data_len = 0; | ||
646 | } | 666 | } |
647 | 667 | ||
648 | /* | 668 | /* |