From 06aeb2b45c606d948d84d47402c1c8402a33b584 Mon Sep 17 00:00:00 2001 From: zhangguangzhi Date: Thu, 18 May 2023 20:24:41 +0800 Subject: kbx: Close file handle when return. * kbx/keybox-dump.c (_keybox_dump_find_dups): Close FP on the error paths. -- GnuPG-bug-id: 6495 Signed-off-by: zhangguangzhi --- kbx/keybox-dump.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'kbx') diff --git a/kbx/keybox-dump.c b/kbx/keybox-dump.c index 38608ceaa..bad664721 100644 --- a/kbx/keybox-dump.c +++ b/kbx/keybox-dump.c @@ -810,6 +810,8 @@ _keybox_dump_find_dups (const char *filename, int print_them, FILE *outfp) gpg_error_t tmperr = gpg_error_from_syserror (); fprintf (outfp, "error allocating array for '%s': %s\n", filename, strerror(errno)); + if (fp != es_stdin) + es_fclose (fp); return tmperr; } dupitems_count = 0; @@ -834,6 +836,8 @@ _keybox_dump_find_dups (const char *filename, int print_them, FILE *outfp) fprintf (outfp, "error reallocating array for '%s': %s\n", filename, strerror(errno)); free (dupitems); + if (fp != es_stdin) + es_fclose (fp); return tmperr; } dupitems = tmp; -- cgit v1.2.3