mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 13:45:50 +00:00
- Prevent using of uninitialized values in error case
- Don't leak ServiceHandle and ServiceManagerHandle svn path=/trunk/; revision=39406
This commit is contained in:
parent
57ea9f9e02
commit
f7f3a1294f
2 changed files with 6 additions and 4 deletions
|
@ -26,9 +26,9 @@ LPTSTR QueryOpts[] = {
|
||||||
LPSERVICE_STATUS_PROCESS
|
LPSERVICE_STATUS_PROCESS
|
||||||
QueryService(LPCTSTR ServiceName)
|
QueryService(LPCTSTR ServiceName)
|
||||||
{
|
{
|
||||||
SC_HANDLE hSCManager;
|
SC_HANDLE hSCManager = NULL;
|
||||||
LPSERVICE_STATUS_PROCESS pServiceInfo = NULL;
|
LPSERVICE_STATUS_PROCESS pServiceInfo = NULL;
|
||||||
SC_HANDLE hSc;
|
SC_HANDLE hSc = NULL;
|
||||||
DWORD BufSiz = 0;
|
DWORD BufSiz = 0;
|
||||||
DWORD BytesNeeded = 0;
|
DWORD BytesNeeded = 0;
|
||||||
DWORD Ret;
|
DWORD Ret;
|
||||||
|
@ -71,6 +71,8 @@ QueryService(LPCTSTR ServiceName)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CloseServiceHandle(hSc);
|
||||||
|
CloseServiceHandle(hSCManager);
|
||||||
return pServiceInfo;
|
return pServiceInfo;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
|
|
||||||
BOOL Start(LPCTSTR ServiceName, LPCTSTR *ServiceArgs, INT ArgCount)
|
BOOL Start(LPCTSTR ServiceName, LPCTSTR *ServiceArgs, INT ArgCount)
|
||||||
{
|
{
|
||||||
SC_HANDLE hSCManager;
|
SC_HANDLE hSCManager = NULL;
|
||||||
SC_HANDLE hSc;
|
SC_HANDLE hSc = NULL;
|
||||||
LPSERVICE_STATUS_PROCESS pServiceInfo = NULL;
|
LPSERVICE_STATUS_PROCESS pServiceInfo = NULL;
|
||||||
|
|
||||||
#ifdef SCDBG
|
#ifdef SCDBG
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue