[openssh-commits] [openssh] 01/04: upstream: save an unneccessary alloc/free, based on patch from

git+noreply at mindrot.org git+noreply at mindrot.org
Tue Mar 1 13:01:07 AEDT 2022


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

djm pushed a commit to branch master
in repository openssh.

commit 4a66dac052c5ff5047161853f36904607649e4f9
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Fri Feb 25 02:09:27 2022 +0000

    upstream: save an unneccessary alloc/free, based on patch from
    
    Martin Vahlensieck; ok dtucker@
    
    OpenBSD-Commit-ID: 90ffbf1f837e509742f2c31a1fbf2c0fd376fd5f
---
 monitor.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/monitor.c b/monitor.c
index c199cb9b..20b9f67b 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor.c,v 1.231 2022/01/28 06:18:42 guenther Exp $ */
+/* $OpenBSD: monitor.c,v 1.232 2022/02/25 02:09:27 djm Exp $ */
 /*
  * Copyright 2002 Niels Provos <provos at citi.umich.edu>
  * Copyright 2002 Markus Friedl <markus at openbsd.org>
@@ -709,7 +709,6 @@ mm_answer_sign(struct ssh *ssh, int sock, struct sshbuf *m)
 int
 mm_answer_pwnamallow(struct ssh *ssh, int sock, struct sshbuf *m)
 {
-	char *username;
 	struct passwd *pwent;
 	int r, allowed = 0;
 	u_int i;
@@ -719,14 +718,12 @@ mm_answer_pwnamallow(struct ssh *ssh, int sock, struct sshbuf *m)
 	if (authctxt->attempt++ != 0)
 		fatal_f("multiple attempts for getpwnam");
 
-	if ((r = sshbuf_get_cstring(m, &username, NULL)) != 0)
+	if ((r = sshbuf_get_cstring(m, &authctxt->user, NULL)) != 0)
 		fatal_fr(r, "parse");
 
-	pwent = getpwnamallow(ssh, username);
+	pwent = getpwnamallow(ssh, authctxt->user);
 
-	authctxt->user = xstrdup(username);
-	setproctitle("%s [priv]", pwent ? username : "unknown");
-	free(username);
+	setproctitle("%s [priv]", pwent ? authctxt->user : "unknown");
 
 	sshbuf_reset(m);
 

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


More information about the openssh-commits mailing list