git: 963c7b084b8b - main - ssh-keysign: fix double free in error path

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Tue, 04 Oct 2022 21:17:25 UTC
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=963c7b084b8bf2397deced4f568b976a42611910

commit 963c7b084b8bf2397deced4f568b976a42611910
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-10-04 20:34:15 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-10-04 20:34:37 +0000

    ssh-keysign: fix double free in error path
    
    From OpenSSH-portable commit 141535b904b6, OpenBSD commit 3d21aa127b1f.
    
    MFC after:              3 days
---
 crypto/openssh/ssh-keysign.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/crypto/openssh/ssh-keysign.c b/crypto/openssh/ssh-keysign.c
index c52321e220e7..b989f5e941ad 100644
--- a/crypto/openssh/ssh-keysign.c
+++ b/crypto/openssh/ssh-keysign.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keysign.c,v 1.70 2022/01/06 22:00:18 djm Exp $ */
+/* $OpenBSD: ssh-keysign.c,v 1.71 2022/08/01 11:09:26 djm Exp $ */
 /*
  * Copyright (c) 2002 Markus Friedl.  All rights reserved.
  *
@@ -155,9 +155,7 @@ valid_request(struct passwd *pw, char *host, struct sshkey **ret, char **pkalgp,
 
 	debug3_f("fail %d", fail);
 
-	if (fail)
-		sshkey_free(key);
-	else {
+	if (!fail) {
 		if (ret != NULL) {
 			*ret = key;
 			key = NULL;