From 9adaa79ab43e2f87178b8ee5ab1a353cba384606 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Tue, 28 May 2024 17:19:37 +0200 Subject: [PATCH] gpg-auth: Fix use after free. * tools/gpg-auth.c (ssh_authorized_keys): Move free after printing error message. -- Signed-off-by: Jakub Jelen This is part of GnuPG-bug-id: 7129 --- tools/gpg-auth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/gpg-auth.c b/tools/gpg-auth.c index a818bee5d..c47bb4e54 100644 --- a/tools/gpg-auth.c +++ b/tools/gpg-auth.c @@ -818,7 +818,6 @@ ssh_authorized_keys (const char *user, struct ssh_key_list **r_ssh_key_list) xfree (fname); return err; } - xfree (fname); maxlen = 2048; /* Set limit. */ while ((len = es_read_line (fp, &line, &length_of_line, &maxlen)) > 0) @@ -861,6 +860,7 @@ ssh_authorized_keys (const char *user, struct ssh_key_list **r_ssh_key_list) *r_ssh_key_list = ssh_key_list; leave: + xfree (fname); xfree (line); es_fclose (fp); return err;