mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 12:02:02 +00:00
[MSCONFIG]
- fix possible leaks CID #716286 CID #716287 svn path=/trunk/; revision=62677
This commit is contained in:
parent
1f6df38614
commit
094caa6e2a
2 changed files with 11 additions and 2 deletions
|
@ -109,17 +109,22 @@ GetServices ( void )
|
||||||
/* reserve memory for service info array */
|
/* reserve memory for service info array */
|
||||||
pServiceStatus = HeapAlloc(GetProcessHeap(), 0, BytesNeeded);
|
pServiceStatus = HeapAlloc(GetProcessHeap(), 0, BytesNeeded);
|
||||||
if (!pServiceStatus)
|
if (!pServiceStatus)
|
||||||
|
{
|
||||||
|
CloseServiceHandle(ScHandle);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* fill array with service info */
|
/* 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)
|
if (EnumServicesStatusEx(ScHandle, SC_ENUM_PROCESS_INFO, SERVICE_WIN32, SERVICE_STATE_ALL, (LPBYTE)pServiceStatus, BytesNeeded, &BytesNeeded, &NumServices, &ResumeHandle, 0) == 0)
|
||||||
{
|
{
|
||||||
HeapFree(GetProcessHeap(), 0, pServiceStatus);
|
HeapFree(GetProcessHeap(), 0, pServiceStatus);
|
||||||
|
CloseServiceHandle(ScHandle);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* exit on failure */
|
else /* exit on failure */
|
||||||
{
|
{
|
||||||
|
CloseServiceHandle(ScHandle);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,7 +132,11 @@ GetServices ( void )
|
||||||
if (NumServices)
|
if (NumServices)
|
||||||
{
|
{
|
||||||
if (!pServiceStatus)
|
if (!pServiceStatus)
|
||||||
|
{
|
||||||
|
CloseServiceHandle(ScHandle);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (Index = 0; Index < NumServices; Index++)
|
for (Index = 0; Index < NumServices; Index++)
|
||||||
{
|
{
|
||||||
memset(&item, 0, sizeof(LV_ITEM));
|
memset(&item, 0, sizeof(LV_ITEM));
|
||||||
|
|
|
@ -199,8 +199,8 @@ GetAutostartEntriesFromRegistry ( HKEY hRootKey, TCHAR* KeyName )
|
||||||
item.pszText = Path;
|
item.pszText = Path;
|
||||||
item.iSubItem = 2;
|
item.iSubItem = 2;
|
||||||
SendMessage(hStartupListCtrl, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);
|
SendMessage(hStartupListCtrl, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);
|
||||||
HeapFree(GetProcessHeap(), 0, Data);
|
|
||||||
}
|
}
|
||||||
|
HeapFree(GetProcessHeap(), 0, Data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue