aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Jelen <[email protected]>2024-07-15 18:39:04 +0000
committerNIIBE Yutaka <[email protected]>2024-07-22 04:38:09 +0000
commit4bdd43fdca20c5162e0cb297f287d9235f151c43 (patch)
tree4d885fdaf807939250506bcdc8c7d6ca7ac573e7
parentexport_secret_ssh_key: Avoid memory leak. (diff)
downloadgnupg-4bdd43fdca20c5162e0cb297f287d9235f151c43.tar.gz
gnupg-4bdd43fdca20c5162e0cb297f287d9235f151c43.zip
dotlock: Avoid leaking directory handle.
* common/dotlock.c (dotlock_detect_tname): Close directory on errors. -- GnuPG-bug-id: 7201 Signed-off-by: Jakub Jelen <[email protected]>
-rw-r--r--common/dotlock.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/common/dotlock.c b/common/dotlock.c
index ae77fad8a..19611ab7a 100644
--- a/common/dotlock.c
+++ b/common/dotlock.c
@@ -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;