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:
Joachim Nilsson
2016-07-04 12:42:22 +02:00
parent 14f547b638
commit a2c8dddaad
+4 -2
View File
@@ -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