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
1 changed files with 5 additions and 2 deletions

View File

@ -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);
}