- markus@cvs.openbsd.org 2001/06/19 15:40:45
[session.c]
allocate and free at the same level.
diff --git a/session.c b/session.c
index 187f38e..fbdc419 100644
--- a/session.c
+++ b/session.c
@@ -33,7 +33,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: session.c,v 1.91 2001/06/19 14:09:45 markus Exp $");
+RCSID("$OpenBSD: session.c,v 1.92 2001/06/19 15:40:45 markus Exp $");
#include "ssh.h"
#include "ssh1.h"
@@ -150,7 +150,7 @@
extern void destroy_sensitive_data(void);
/* original command from peer. */
-char *original_command = NULL;
+const char *original_command = NULL;
/* data */
#define MAX_SESSIONS 10
@@ -309,12 +309,12 @@
if (type == SSH_CMSG_EXEC_CMD) {
command = packet_get_string(&dlen);
debug("Exec command '%.500s'", command);
- packet_integrity_check(plen, 4 + dlen, type);
+ do_exec(s, command);
+ xfree(command);
} else {
- command = NULL;
- packet_integrity_check(plen, 0, type);
+ do_exec(s, NULL);
}
- do_exec(s, command);
+ packet_done();
session_close(s);
return;
@@ -608,13 +608,7 @@
else
do_exec_no_pty(s, command);
- if (command != NULL)
- xfree(command);
-
- if (original_command != NULL) {
- xfree(original_command);
- original_command = NULL;
- }
+ original_command = NULL;
}
@@ -1698,6 +1692,7 @@
char *command = packet_get_string(&len);
packet_done();
do_exec(s, command);
+ xfree(command);
return 1;
}