summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhangguangzhi <zhangguangzhi3@huawei.com>2023-05-18 14:24:41 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2023-06-20 02:20:49 +0200
commit06aeb2b45c606d948d84d47402c1c8402a33b584 (patch)
treecaa1e94d6ac104631d629984847af26deff6b6d2
parentdelete redundant characters (diff)
downloadgnupg2-06aeb2b45c606d948d84d47402c1c8402a33b584.tar.xz
gnupg2-06aeb2b45c606d948d84d47402c1c8402a33b584.zip
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 <zhangguangzhi3@huawei.com>
-rw-r--r--kbx/keybox-dump.c4
1 files changed, 4 insertions, 0 deletions
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;