aboutsummaryrefslogtreecommitdiffstats
path: root/common/dotlock.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2023-12-20 01:28:02 +0000
committerNIIBE Yutaka <[email protected]>2023-12-20 02:05:12 +0000
commit5488ad0517422b31a7be46a7575f5f5492e9fee1 (patch)
treea498eabef3f90e3400dd0cf91e307a78b6417cac /common/dotlock.c
parentcommon: Improve the parsing of gpgconf.ctl variables. (diff)
downloadgnupg-5488ad0517422b31a7be46a7575f5f5492e9fee1.tar.gz
gnupg-5488ad0517422b31a7be46a7575f5f5492e9fee1.zip
common: Fix a possible resource leak for dotlock.
* common/dotlock.c (dotlock_destroy_unix): Don't release ->TNAME here. (dotlock_destroy): Release the memory unconditionally. -- Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'common/dotlock.c')
-rw-r--r--common/dotlock.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/common/dotlock.c b/common/dotlock.c
index f4d7243e0..06e3910ad 100644
--- a/common/dotlock.c
+++ b/common/dotlock.c
@@ -1155,7 +1155,6 @@ dotlock_destroy_unix (dotlock_t h)
unlink (h->lockname);
if (h->tname && !h->use_o_excl)
unlink (h->tname);
- xfree (h->tname);
}
#endif /*HAVE_POSIX_SYSTEM*/
@@ -1208,8 +1207,12 @@ dotlock_destroy (dotlock_t h)
#else /* !HAVE_DOSISH_SYSTEM */
dotlock_destroy_unix (h);
#endif /* HAVE_DOSISH_SYSTEM */
- xfree (h->lockname);
}
+
+#ifdef HAVE_POSIX_SYSTEM
+ xfree (h->tname);
+#endif
+ xfree (h->lockname);
xfree(h);
}