changeset 9976:a945dec9643d

6853997 ssh is freeing memory with the hostname it needs later
author Jan Pechanec <Jan.Pechanec@Sun.COM>
date Fri, 26 Jun 2009 01:50:02 -0700
parents 9a78e9b6760d
children 17b7501a895e
files usr/src/cmd/ssh/ssh/sshconnect.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/ssh/ssh/sshconnect.c	Fri Jun 26 00:59:33 2009 -0700
+++ b/usr/src/cmd/ssh/ssh/sshconnect.c	Fri Jun 26 01:50:02 2009 -0700
@@ -1003,6 +1003,10 @@
 	/* key exchange */
 	/* authenticate user */
 	if (compat20) {
+		/*
+		 * Note that the host pointer is saved in ssh_kex2() for later
+		 * use during the key re-exchanges so we must not xfree() it.
+		 */
 		ssh_kex2(host, hostaddr);
 		ssh_userauth2(local_user, server_user, host, sensitive);
 	} else {
@@ -1010,7 +1014,6 @@
 		ssh_userauth1(local_user, server_user, host, sensitive);
 	}
 
-	xfree(host);
 	xfree(local_user);
 }