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

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 <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2023-12-20 10:28:02 +09:00
parent 8eff1d4c51
commit 5488ad0517
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054

View File

@ -1155,7 +1155,6 @@ dotlock_destroy_unix (dotlock_t h)
unlink (h->lockname); unlink (h->lockname);
if (h->tname && !h->use_o_excl) if (h->tname && !h->use_o_excl)
unlink (h->tname); unlink (h->tname);
xfree (h->tname);
} }
#endif /*HAVE_POSIX_SYSTEM*/ #endif /*HAVE_POSIX_SYSTEM*/
@ -1208,8 +1207,12 @@ dotlock_destroy (dotlock_t h)
#else /* !HAVE_DOSISH_SYSTEM */ #else /* !HAVE_DOSISH_SYSTEM */
dotlock_destroy_unix (h); dotlock_destroy_unix (h);
#endif /* HAVE_DOSISH_SYSTEM */ #endif /* HAVE_DOSISH_SYSTEM */
xfree (h->lockname);
} }
#ifdef HAVE_POSIX_SYSTEM
xfree (h->tname);
#endif
xfree (h->lockname);
xfree(h); xfree(h);
} }