mirror of
https://github.com/troglobit/libite.git
synced 2026-10-02 13:52:51 +07: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:
@@ -122,8 +122,10 @@ pidfile(const char *basename)
|
||||
static void
|
||||
pidfile_cleanup(void)
|
||||
{
|
||||
|
||||
if (pidfile_path != NULL && pidfile_pid == getpid())
|
||||
if (pidfile_path != NULL && pidfile_pid == getpid()) {
|
||||
(void) unlink(pidfile_path);
|
||||
free(pidfile_path);
|
||||
pidfile_path = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user