mirror of
https://github.com/troglobit/libite.git
synced 2026-10-30 12:40:38 +00:00
Free pidfile_path atexit()
To prevent warnings from tools like Valgrind, or handle issues with RAM leaks on non-MMU systems like uClinux, we must free the memory allocated by pidfile(). Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
14f547b638
commit
a2c8dddaad
1 file changed
+4
-2
@@ -122,8 +122,10 @@ pidfile(const char *basename)
|
|||||||
static void
|
static void
|
||||||
pidfile_cleanup(void)
|
pidfile_cleanup(void)
|
||||||
{
|
{
|
||||||
|
if (pidfile_path != NULL && pidfile_pid == getpid()) {
|
||||||
if (pidfile_path != NULL && pidfile_pid == getpid())
|
|
||||||
(void) unlink(pidfile_path);
|
(void) unlink(pidfile_path);
|
||||||
|
free(pidfile_path);
|
||||||
|
pidfile_path = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
Reference in new issue
Block a user