1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-09-18 14:31:42 +02:00

dotlock: Avoid leaking directory handle.

* common/dotlock.c (dotlock_detect_tname): Close directory on errors.

--

GnuPG-bug-id: 7201
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Jakub Jelen 2024-07-15 20:39:04 +02:00 committed by NIIBE Yutaka
parent f66e9356f8
commit 4bdd43fdca
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054

View File

@ -724,6 +724,7 @@ dotlock_detect_tname (dotlock_t h)
if (dlen > len)
{
closedir (dir);
xfree (basename);
xfree (dirname);
return -1;
@ -734,6 +735,7 @@ dotlock_detect_tname (dotlock_t h)
tname_path = strchr (h->tname + strlen (dirname) + 2, '.');
if (!tname_path)
{
closedir (dir);
xfree (basename);
xfree (dirname);
return -1;