- markus@cvs.openbsd.org 2001/06/11 10:18:24
     [session.c]
     reset pointer to NULL after xfree(); report from solar@openwall.com
diff --git a/ChangeLog b/ChangeLog
index 72ad70a..2ddcce0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,9 @@
      [dispatch.c]
      we support rekeying
      protocol errors are fatal.
+   - markus@cvs.openbsd.org 2001/06/11 10:18:24
+     [session.c]
+     reset pointer to NULL after xfree(); report from solar@openwall.com
 
 20010611
  - (bal) NeXT/MacOS X lack libgen.h and dirname().  Patch by Mark Miller 
@@ -5610,4 +5613,4 @@
  - Wrote replacements for strlcpy and mkdtemp
  - Released 1.0pre1
 
-$Id: ChangeLog,v 1.1278 2001/06/12 00:15:57 mouring Exp $
+$Id: ChangeLog,v 1.1279 2001/06/12 00:21:34 mouring Exp $
diff --git a/session.c b/session.c
index 9f472a2..4dfca35 100644
--- a/session.c
+++ b/session.c
@@ -33,7 +33,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: session.c,v 1.83 2001/06/07 22:25:02 markus Exp $");
+RCSID("$OpenBSD: session.c,v 1.84 2001/06/11 10:18:24 markus Exp $");
 
 #include "ssh.h"
 #include "ssh1.h"
@@ -364,6 +364,8 @@
 			if (!success) {
 				xfree(s->auth_proto);
 				xfree(s->auth_data);
+				s->auth_proto = NULL;
+				s->auth_data = NULL;
 			}
 			break;
 
@@ -1047,7 +1049,7 @@
 	extern char **environ;
 	struct stat st;
 	char *argv[10];
-	int do_xauth = s->auth_proto != NULL && s->auth_data != NULL;
+	int do_xauth;
 #ifdef WITH_IRIX_PROJECT
 	prid_t projid;
 #endif /* WITH_IRIX_PROJECT */
@@ -1059,6 +1061,9 @@
 #endif /* WITH_IRIX_ARRAY */
 #endif /* WITH_IRIX_JOBS */
 
+	do_xauth =
+	    s->display != NULL && s->auth_proto != NULL && s->auth_data != NULL;
+
 	/* remove hostkey from the child's memory */
 	destroy_sensitive_data();
 
@@ -1731,6 +1736,8 @@
 	if (!success) {
 		xfree(s->auth_proto);
 		xfree(s->auth_data);
+		s->auth_proto = NULL;
+		s->auth_data = NULL;
 	}
 	return success;
 }