From e8c8068decb3351046d30ea45913f831414eb8c0 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Mon, 15 Jul 2024 19:55:44 +0200 Subject: [PATCH] tools: Avoid memory leaks. * tools/gpg-auth.c (ssh_authorized_keys): Free list on error. * tools/gpgtar-extract.c (gpgtar_extract): Free memory on error. -- GnuPG-bug-id: 7201 Signed-off-by: Jakub Jelen --- tools/gpg-auth.c | 1 + tools/gpgtar-extract.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/gpg-auth.c b/tools/gpg-auth.c index 874861b25..f768215d4 100644 --- a/tools/gpg-auth.c +++ b/tools/gpg-auth.c @@ -825,6 +825,7 @@ ssh_authorized_keys (const char *user, struct ssh_key_list **r_ssh_key_list) { err = gpg_error (GPG_ERR_LINE_TOO_LONG); log_error (_("error reading '%s': %s\n"), fname, gpg_strerror (err)); + release_ssh_key_list (ssh_key_list); goto leave; } diff --git a/tools/gpgtar-extract.c b/tools/gpgtar-extract.c index 8793ecd33..c6e3b6065 100644 --- a/tools/gpgtar-extract.c +++ b/tools/gpgtar-extract.c @@ -467,7 +467,7 @@ gpgtar_extract (const char *filename, int decrypt) { err = gpg_error_from_syserror (); log_error ("error opening '%s': %s\n", filename, gpg_strerror (err)); - return err; + goto leave; } if (stream == es_stdin) es_set_binary (es_stdin);