Ensure we call free_imports() when exiting.
authorIain Patterson <me@iain.cx>
Fri, 5 Aug 2016 09:22:38 +0000 (10:22 +0100)
committerIain Patterson <me@iain.cx>
Fri, 5 Aug 2016 09:31:38 +0000 (10:31 +0100)
nssm.cpp
service.cpp

index 9fde560..d70c6b4 100644 (file)
--- a/nssm.cpp
+++ b/nssm.cpp
@@ -9,6 +9,7 @@ static TCHAR imagepath[PATH_LENGTH];
 static TCHAR imageargv0[PATH_LENGTH];\r
 \r
 void nssm_exit(int status) {\r
+  free_imports();\r
   unsetup_utf8();\r
   exit(status);\r
 }\r
@@ -300,7 +301,6 @@ int _tmain(int argc, TCHAR **argv) {
       /* User probably ran nssm with no argument */\r
       if (error == ERROR_FAILED_SERVICE_CONTROLLER_CONNECT) nssm_exit(usage(1));\r
       log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_DISPATCHER_FAILED, error_string(error), 0);\r
-      free_imports();\r
       nssm_exit(100);\r
     }\r
   }\r
index 336cf27..d66b916 100644 (file)
@@ -2110,7 +2110,6 @@ void CALLBACK end_service(void *arg, unsigned char why) {
       log_event(EVENTLOG_INFORMATION_TYPE, NSSM_EVENT_EXIT_UNCLEAN, service->name, code, exit_action_strings[action], 0);\r
       stop_service(service, exitcode, false, default_action);\r
       wait_for_hooks(service, false);\r
-      free_imports();\r
       nssm_exit(exitcode);\r
   }\r
 }\r