From 3e55f1d2cc673d55ee342ff168a335b321501ee0 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Thu, 16 Jul 2015 11:56:05 +0100 Subject: [PATCH] advapi32: Don't call CloseServiceHandle() with an invalid handle. --- dlls/advapi32/security.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c index c2ce1e1d031..b632577f513 100644 --- a/dlls/advapi32/security.c +++ b/dlls/advapi32/security.c @@ -431,8 +431,10 @@ static inline DWORD get_security_service( LPWSTR full_service_name, DWORD access err = SERV_OpenSCManagerW( NULL, NULL, access, (SC_HANDLE *)&manager ); if (err == ERROR_SUCCESS) + { err = SERV_OpenServiceW( manager, full_service_name, access, (SC_HANDLE *)service ); - CloseServiceHandle( manager ); + CloseServiceHandle( manager ); + } return err; }