[openssh-commits] [openssh] 01/03: upstream commit

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Sep 11 13:28:07 AEST 2015


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit 4f7cc2f8cc861a21e6dbd7f6c25652afb38b9b96
Author: dtucker at openbsd.org <dtucker at openbsd.org>
Date:   Fri Sep 4 08:21:47 2015 +0000

    upstream commit
    
    Plug minor memory leaks when options are used more than
     once.  bz#2182, patch from Tiago Cunha, ok deraadt djm
    
    Upstream-ID: 5b84d0401e27fe1614c10997010cc55933adb48e
---
 ssh.c  | 15 ++++++++-------
 sshd.c |  8 +++-----
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/ssh.c b/ssh.c
index 6053db2..bf8c9c6 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.421 2015/09/04 04:56:09 djm Exp $ */
+/* $OpenBSD: ssh.c,v 1.422 2015/09/04 08:21:47 dtucker Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -627,7 +627,7 @@ main(int ac, char **av)
 			use_syslog = 1;
 			break;
 		case 'E':
-			logfile = xstrdup(optarg);
+			logfile = optarg;
 			break;
 		case 'G':
 			config_test = 1;
@@ -714,6 +714,7 @@ main(int ac, char **av)
 			break;
 		case 'I':
 #ifdef ENABLE_PKCS11
+			free(options.pkcs11_provider);
 			options.pkcs11_provider = xstrdup(optarg);
 #else
 			fprintf(stderr, "no support for PKCS#11.\n");
@@ -798,6 +799,7 @@ main(int ac, char **av)
 			if (ciphers_valid(*optarg == '+' ?
 			    optarg + 1 : optarg)) {
 				/* SSH2 only */
+				free(options.ciphers);
 				options.ciphers = xstrdup(optarg);
 				options.cipher = SSH_CIPHER_INVALID;
 				break;
@@ -817,9 +819,10 @@ main(int ac, char **av)
 				options.ciphers = xstrdup(KEX_CLIENT_ENCRYPT);
 			break;
 		case 'm':
-			if (mac_valid(optarg))
+			if (mac_valid(optarg)) {
+				free(options.macs);
 				options.macs = xstrdup(optarg);
-			else {
+			} else {
 				fprintf(stderr, "Unknown mac type '%s'\n",
 				    optarg);
 				exit(255);
@@ -980,10 +983,8 @@ main(int ac, char **av)
 	 */
 	if (use_syslog && logfile != NULL)
 		fatal("Can't specify both -y and -E");
-	if (logfile != NULL) {
+	if (logfile != NULL)
 		log_redirect_stderr_to(logfile);
-		free(logfile);
-	}
 	log_init(argv0,
 	    options.log_level == -1 ? SYSLOG_LEVEL_INFO : options.log_level,
 	    SYSLOG_FACILITY_USER, !use_syslog);
diff --git a/sshd.c b/sshd.c
index 65ef7e8..d868089 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshd.c,v 1.458 2015/08/20 22:32:42 deraadt Exp $ */
+/* $OpenBSD: sshd.c,v 1.459 2015/09/04 08:21:47 dtucker Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -1530,7 +1530,7 @@ main(int ac, char **av)
 			no_daemon_flag = 1;
 			break;
 		case 'E':
-			logfile = xstrdup(optarg);
+			logfile = optarg;
 			/* FALLTHROUGH */
 		case 'e':
 			log_stderr = 1;
@@ -1632,10 +1632,8 @@ main(int ac, char **av)
 #endif
 
 	/* If requested, redirect the logs to the specified logfile. */
-	if (logfile != NULL) {
+	if (logfile != NULL)
 		log_redirect_stderr_to(logfile);
-		free(logfile);
-	}
 	/*
 	 * Force logging to stderr until we have loaded the private host
 	 * key (unless started from inetd)

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list