- Prevent using of uninitialized values in error case

- Don't leak ServiceHandle and ServiceManagerHandle

svn path=/trunk/; revision=39406
This commit is contained in:
Johannes Anderwald 2009-02-05 12:56:11 +00:00
parent 57ea9f9e02
commit f7f3a1294f
2 changed files with 6 additions and 4 deletions

View file

@ -26,9 +26,9 @@ LPTSTR QueryOpts[] = {
LPSERVICE_STATUS_PROCESS
QueryService(LPCTSTR ServiceName)
{
SC_HANDLE hSCManager;
SC_HANDLE hSCManager = NULL;
LPSERVICE_STATUS_PROCESS pServiceInfo = NULL;
SC_HANDLE hSc;
SC_HANDLE hSc = NULL;
DWORD BufSiz = 0;
DWORD BytesNeeded = 0;
DWORD Ret;
@ -71,6 +71,8 @@ QueryService(LPCTSTR ServiceName)
goto fail;
}
CloseServiceHandle(hSc);
CloseServiceHandle(hSCManager);
return pServiceInfo;
fail:

View file

@ -11,8 +11,8 @@
BOOL Start(LPCTSTR ServiceName, LPCTSTR *ServiceArgs, INT ArgCount)
{
SC_HANDLE hSCManager;
SC_HANDLE hSc;
SC_HANDLE hSCManager = NULL;
SC_HANDLE hSc = NULL;
LPSERVICE_STATUS_PROCESS pServiceInfo = NULL;
#ifdef SCDBG