diff options
author | Matt Johnston <matt@ucc.asn.au> | 2015-02-24 22:01:33 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2015-02-24 22:01:33 +0800 |
commit | 21bed0d21aa765c7796d977fcb36902399e97242 (patch) | |
tree | 9bcdd6ef0ba69f74b2b8f8675b3bca414ad3e4c1 /svr-session.c | |
parent | 4b1f5ec7c29043a7d4ec0dd75f10479ed909a187 (diff) |
Free memory before exiting. Based on patch from Thorsten Horstmann.
Client side is not complete.
Diffstat (limited to 'svr-session.c')
-rw-r--r-- | svr-session.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/svr-session.c b/svr-session.c index 343cb30..2b8a956 100644 --- a/svr-session.c +++ b/svr-session.c @@ -78,10 +78,13 @@ static const struct ChanType *svr_chantypes[] = { }; static void -svr_session_cleanup(void) -{ +svr_session_cleanup(void) { /* free potential public key options */ svr_pubkey_options_cleanup(); + + m_free(svr_ses.addrstring); + m_free(svr_ses.childpids); + m_free(svr_ses.remotehost); } static void @@ -150,6 +153,7 @@ void svr_session(int sock, int childpipe) { void svr_dropbear_exit(int exitcode, const char* format, va_list param) { char fmtbuf[300]; + int i; if (!sessinitdone) { /* before session init */ @@ -183,6 +187,15 @@ void svr_dropbear_exit(int exitcode, const char* format, va_list param) { session_cleanup(); } + if (svr_opts.hostkey) { + sign_key_free(svr_opts.hostkey); + svr_opts.hostkey = NULL; + } + for (i = 0; i < DROPBEAR_MAX_PORTS; i++) { + m_free(svr_opts.addresses[i]); + m_free(svr_opts.ports[i]); + } + exit(exitcode); } |