As we're running each plugin in a fork, we need to call our cleanup code so we don't leak memory. To this extent, we now have the global boolean rc_in_plugin and the cleanup code can act accordingly.

This commit is contained in:
Roy Marples
2007-07-04 16:02:01 +00:00
parent 46156cc8cd
commit f28763d492
4 changed files with 27 additions and 9 deletions

View File

@@ -83,7 +83,7 @@ static void cleanup (void)
rc_plugin_unload ();
if (termios_orig) {
if (! rc_in_plugin && termios_orig) {
tcsetattr (STDIN_FILENO, TCSANOW, termios_orig);
free (termios_orig);
}
@@ -103,10 +103,12 @@ static void cleanup (void)
rc_strlist_free (types);
/* Clean runlevel start, stop markers */
if (rc_is_dir (RC_SVCDIR "softscripts.new"))
rc_rm_dir (RC_SVCDIR "softscripts.new", true);
if (rc_is_dir (RC_SVCDIR "softscripts.old"))
rc_rm_dir (RC_SVCDIR "softscripts.old", true);
if (! rc_in_plugin) {
if (rc_is_dir (RC_SVCDIR "softscripts.new"))
rc_rm_dir (RC_SVCDIR "softscripts.new", true);
if (rc_is_dir (RC_SVCDIR "softscripts.old"))
rc_rm_dir (RC_SVCDIR "softscripts.old", true);
}
free (applet);
}