aboutsummaryrefslogtreecommitdiff
path: root/src/rc/rc.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-10-06 15:02:32 +0000
committerRoy Marples <roy@marples.name>2008-10-06 15:02:32 +0000
commitcb44b0a46c9b1c72a84cf65e6b4d6ae735c0e413 (patch)
treec203264849ad86d67ddfb86242ef2aa0680a9b8b /src/rc/rc.c
parent4e4c4a5bf4d5c463b79b5648e614b3b780efdbec (diff)
#ifdef atexit cleanups calling free as the OS should do this for us, but valgrind debuggers need it.
Diffstat (limited to 'src/rc/rc.c')
-rw-r--r--src/rc/rc.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/rc/rc.c b/src/rc/rc.c
index e6472bdb..4fee7002 100644
--- a/src/rc/rc.c
+++ b/src/rc/rc.c
@@ -137,8 +137,10 @@ static void clean_failed(void)
static void cleanup(void)
{
if (applet && strcmp(applet, "rc") == 0) {
+#ifdef DEBUG_MEMORY
RC_PID *p1 = LIST_FIRST(&service_pids);
RC_PID *p2;
+#endif
if (hook_out)
rc_plugin_run(hook_out, runlevel);
@@ -150,6 +152,16 @@ static void cleanup(void)
free(termios_orig);
}
+ /* Clean runlevel start, stop markers */
+ if (! rc_in_plugin && ! rc_in_logger) {
+ rmdir(RC_STARTING);
+ rmdir(RC_STOPPING);
+ clean_failed();
+
+ rc_logger_close();
+ }
+
+#ifdef DEBUG_MEMORY
while (p1) {
p2 = LIST_NEXT(p1, entries);
free(p1);
@@ -162,17 +174,8 @@ static void cleanup(void)
rc_stringlist_free(types_n);
rc_stringlist_free(types_nua);
rc_deptree_free(deptree);
-
- /* Clean runlevel start, stop markers */
- if (! rc_in_plugin && ! rc_in_logger) {
- rmdir(RC_STARTING);
- rmdir(RC_STOPPING);
- clean_failed();
-
- rc_logger_close();
- }
-
free(runlevel);
+#endif
}
}