diff options
author | Matt Johnston <matt@ucc.asn.au> | 2015-02-24 22:17:04 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2015-02-24 22:17:04 +0800 |
commit | 8008b595d376062556bc3e86f6e0f2ef631d7cf5 (patch) | |
tree | 42828ee41ae11514e3de9f4288669cb27285fad7 /common-session.c | |
parent | 21bed0d21aa765c7796d977fcb36902399e97242 (diff) |
Some additional cleanup functions
Diffstat (limited to 'common-session.c')
-rw-r--r-- | common-session.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/common-session.c b/common-session.c index a225b21..971955a 100644 --- a/common-session.c +++ b/common-session.c @@ -260,13 +260,16 @@ void session_cleanup() { return; } + /* Beware of changing order of functions here. */ + + /* Must be before extra_session_cleanup() */ + chancleanup(); + if (ses.extra_session_cleanup) { ses.extra_session_cleanup(); } - chancleanup(); - - /* Most dropbear functions are unsafe to run after this point */ + /* After these are freed most functions will exit */ #ifdef DROPBEAR_CLEANUP /* listeners call cleanup functions, this should occur before other session state is freed. */ @@ -289,6 +292,12 @@ void session_cleanup() { cleanup_buf(&ses.payload); cleanup_buf(&ses.readbuf); cleanup_buf(&ses.writepayload); + cleanup_buf(&ses.kexhashbuf); + cleanup_buf(&ses.transkexinit); + if (ses.dh_K) { + mp_clear(ses.dh_K); + } + m_free(ses.dh_K); m_burn(ses.keys, sizeof(struct key_context)); m_free(ses.keys); |