mirror of
https://github.com/troglobit/libite.git
synced 2026-10-17 10:39:36 +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
|
||||
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