From 02306e50ded439b2560da2160239bc9f7e2785fa Mon Sep 17 00:00:00 2001 From: Markus Friedl Date: Wed, 1 Jul 2020 16:28:32 +0000 Subject: free kex in ssh_packet_close; ok djm semarie --- usr.bin/ssh/packet.c | 4 +++- usr.bin/ssh/ssh_api.c | 6 ++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'usr.bin/ssh') diff --git a/usr.bin/ssh/packet.c b/usr.bin/ssh/packet.c index 0b326e9f7dc..c748dcf31cd 100644 --- a/usr.bin/ssh/packet.c +++ b/usr.bin/ssh/packet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: packet.c,v 1.294 2020/06/26 11:26:01 semarie Exp $ */ +/* $OpenBSD: packet.c,v 1.295 2020/07/01 16:28:31 markus Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -629,6 +629,8 @@ ssh_packet_close_internal(struct ssh *ssh, int do_close) ssh->remote_ipaddr = NULL; free(ssh->state); ssh->state = NULL; + kex_free(ssh->kex); + ssh->kex = NULL; } } diff --git a/usr.bin/ssh/ssh_api.c b/usr.bin/ssh/ssh_api.c index 7d25da36c1c..68b2c14391e 100644 --- a/usr.bin/ssh/ssh_api.c +++ b/usr.bin/ssh/ssh_api.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh_api.c,v 1.19 2019/10/31 21:23:19 djm Exp $ */ +/* $OpenBSD: ssh_api.c,v 1.20 2020/07/01 16:28:31 markus Exp $ */ /* * Copyright (c) 2012 Markus Friedl. All rights reserved. * @@ -146,7 +146,6 @@ ssh_free(struct ssh *ssh) { struct key_entry *k; - ssh_packet_close(ssh); /* * we've only created the public keys variants in case we * are a acting as a server. @@ -161,8 +160,7 @@ ssh_free(struct ssh *ssh) TAILQ_REMOVE(&ssh->private_keys, k, next); free(k); } - if (ssh->kex) - kex_free(ssh->kex); + ssh_packet_close(ssh); free(ssh); } -- cgit v1.2.3