diff options
author | NIIBE Yutaka <[email protected]> | 2023-12-20 01:28:02 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2023-12-20 02:05:12 +0000 |
commit | 5488ad0517422b31a7be46a7575f5f5492e9fee1 (patch) | |
tree | a498eabef3f90e3400dd0cf91e307a78b6417cac /common/dotlock.c | |
parent | common: Improve the parsing of gpgconf.ctl variables. (diff) | |
download | gnupg-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.c | 7 |
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); } |