From 049ac1d827c5e56e6256998564fa3b6170ceb81d Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Thu, 11 Aug 2016 07:22:55 +0200 Subject: [PATCH] services: Hold an additional process reference while waiting for startup. Signed-off-by: Sebastian Lackner Signed-off-by: Alexandre Julliard --- programs/services/services.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/programs/services/services.c b/programs/services/services.c index b0d008d492c..f7a2725006f 100644 --- a/programs/services/services.c +++ b/programs/services/services.c @@ -778,7 +778,7 @@ static DWORD service_start_process(struct service_entry *service_entry, struct p service_entry->status.dwCurrentState = SERVICE_START_PENDING; scmdatabase_add_process(service_entry->db, process); - service_entry->process = process; + service_entry->process = grab_process(process); service_unlock(service_entry); @@ -788,6 +788,7 @@ static DWORD service_start_process(struct service_entry *service_entry, struct p { err = GetLastError(); process_terminate(process); + release_process(process); return err; } @@ -916,6 +917,8 @@ DWORD service_start(struct service_entry *service, DWORD service_argc, LPCWSTR * ReleaseMutex(process->control_mutex); else process_terminate(process); + + release_process(process); } scmdatabase_unlock_startup(service->db);