1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

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>
This commit is contained in:
zhangguangzhi 2023-05-18 20:24:41 +08:00 committed by NIIBE Yutaka
parent be77c05532
commit 28a4d0d4f5
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054

View File

@ -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;