Author: janderwald
Date: Thu Feb 5 06:56:11 2009
New Revision: 39406
URL:
http://svn.reactos.org/svn/reactos?rev=39406&view=rev
Log:
- Prevent using of uninitialized values in error case
- Don't leak ServiceHandle and ServiceManagerHandle
Modified:
trunk/reactos/base/applications/sc/query.c
trunk/reactos/base/applications/sc/start.c
Modified: trunk/reactos/base/applications/sc/query.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sc/query…
==============================================================================
--- trunk/reactos/base/applications/sc/query.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/sc/query.c [iso-8859-1] Thu Feb 5 06:56:11 2009
@@ -26,9 +26,9 @@
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 @@
goto fail;
}
+ CloseServiceHandle(hSc);
+ CloseServiceHandle(hSCManager);
return pServiceInfo;
fail:
Modified: trunk/reactos/base/applications/sc/start.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sc/start…
==============================================================================
--- trunk/reactos/base/applications/sc/start.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/sc/start.c [iso-8859-1] Thu Feb 5 06:56:11 2009
@@ -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