Author: khornicek
Date: Sun Apr 6 21:13:18 2014
New Revision: 62677
URL:
http://svn.reactos.org/svn/reactos?rev=62677&view=rev
Log:
[MSCONFIG]
- fix possible leaks
CID #716286
CID #716287
Modified:
trunk/reactos/base/applications/msconfig/srvpage.c
trunk/reactos/base/applications/msconfig/startuppage.c
Modified: trunk/reactos/base/applications/msconfig/srvpage.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig/srvpage.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig/srvpage.c [iso-8859-1] Sun Apr 6 21:13:18
2014
@@ -109,17 +109,22 @@
/* reserve memory for service info array */
pServiceStatus = HeapAlloc(GetProcessHeap(), 0, BytesNeeded);
if (!pServiceStatus)
+ {
+ CloseServiceHandle(ScHandle);
return;
+ }
/* fill array with service info */
if (EnumServicesStatusEx(ScHandle, SC_ENUM_PROCESS_INFO, SERVICE_WIN32,
SERVICE_STATE_ALL, (LPBYTE)pServiceStatus, BytesNeeded, &BytesNeeded,
&NumServices, &ResumeHandle, 0) == 0)
{
HeapFree(GetProcessHeap(), 0, pServiceStatus);
+ CloseServiceHandle(ScHandle);
return;
}
}
else /* exit on failure */
{
+ CloseServiceHandle(ScHandle);
return;
}
}
@@ -127,7 +132,11 @@
if (NumServices)
{
if (!pServiceStatus)
+ {
+ CloseServiceHandle(ScHandle);
return;
+ }
+
for (Index = 0; Index < NumServices; Index++)
{
memset(&item, 0, sizeof(LV_ITEM));
Modified: trunk/reactos/base/applications/msconfig/startuppage.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig/startuppage.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig/startuppage.c [iso-8859-1] Sun Apr 6
21:13:18 2014
@@ -137,7 +137,7 @@
HeapFree(GetProcessHeap(), 0, Data);
}
}
- RegCloseKey(hKey);
+ RegCloseKey(hKey);
}
}
@@ -199,8 +199,8 @@
item.pszText = Path;
item.iSubItem = 2;
SendMessage(hStartupListCtrl, LVM_SETITEMTEXT, item.iItem, (LPARAM)
&item);
- HeapFree(GetProcessHeap(), 0, Data);
}
+ HeapFree(GetProcessHeap(), 0, Data);
}
}
RegCloseKey(hKey);