diff common-session.c @ 891:e78f5ce6e7bb

cleanup before clearing keys
author Matt Johnston <matt@ucc.asn.au>
date Wed, 12 Feb 2014 22:15:02 +0800
parents cbc73a5aefb0
children a1a97e98b0c1
line wrap: on
line diff
--- a/common-session.c	Fri Feb 07 07:57:45 2014 +0800
+++ b/common-session.c	Wed Feb 12 22:15:02 2014 +0800
@@ -244,7 +244,11 @@
 	if (ses.extra_session_cleanup) {
 		ses.extra_session_cleanup();
 	}
+
+	chancleanup();
 	
+	/* Cleaning up keys must happen after other cleanup
+	functions which might queue packets */
 	if (ses.session_id) {
 		buf_burn(ses.session_id);
 		buf_free(ses.session_id);
@@ -258,8 +262,6 @@
 	m_burn(ses.keys, sizeof(struct key_context));
 	m_free(ses.keys);
 
-	chancleanup();
-
 	TRACE(("leave session_cleanup"))
 }