aboutsummaryrefslogtreecommitdiffstats
path: root/kbx
diff options
context:
space:
mode:
authorzhangguangzhi <[email protected]>2023-05-18 12:24:41 +0000
committerNIIBE Yutaka <[email protected]>2023-06-20 00:18:37 +0000
commit28a4d0d4f5c586e1c82859da9562fa060a4ebc6e (patch)
tree07821db77b477a3a9b3ea60c7172c8b24d43c7b6 /kbx
parentdelete redundant characters (diff)
downloadgnupg-28a4d0d4f5c586e1c82859da9562fa060a4ebc6e.tar.gz
gnupg-28a4d0d4f5c586e1c82859da9562fa060a4ebc6e.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 <[email protected]>
Diffstat (limited to 'kbx')
-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;