mirror of
https://github.com/reactos/reactos.git
synced 2024-10-15 05:37:44 +00:00
[SERVMAN]
- fix resource leaks CID 716292, 716293, 716294 - fix CID 716772 (double free), 513719 (wrong NULL check), 1206739 (cosmetic) - make line endings CR LF when exporting the services list svn path=/trunk/; revision=64882
This commit is contained in:
parent
c7f4cb10e3
commit
2ee22c5764
|
@ -52,7 +52,7 @@ SaveServicesToFile(PMAIN_WND_INFO Info,
|
|||
if(hFile != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
TCHAR LVText[500];
|
||||
TCHAR newl = _T('\n');
|
||||
TCHAR newl[2] = {_T('\r'), _T('\n')};
|
||||
TCHAR tab = _T('\t');
|
||||
DWORD dwTextLength, dwWritten;
|
||||
INT NumListedServ = 0;
|
||||
|
@ -68,7 +68,7 @@ SaveServicesToFile(PMAIN_WND_INFO Info,
|
|||
LVText,
|
||||
i,
|
||||
k);
|
||||
if (LVText != NULL)
|
||||
if (_tcslen(LVText))
|
||||
{
|
||||
WriteFile(hFile,
|
||||
LVText,
|
||||
|
@ -84,8 +84,8 @@ SaveServicesToFile(PMAIN_WND_INFO Info,
|
|||
}
|
||||
}
|
||||
WriteFile(hFile,
|
||||
&newl,
|
||||
sizeof(TCHAR),
|
||||
newl,
|
||||
sizeof(newl),
|
||||
&dwWritten,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
@ -204,10 +204,11 @@ VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info)
|
|||
SendMessage(Info->hTool, TB_SETSTATE, ID_RESTART,
|
||||
(LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, lpServiceConfig);
|
||||
}
|
||||
|
||||
if(lpServiceConfig)
|
||||
HeapFree(GetProcessHeap(), 0, lpServiceConfig);
|
||||
|
||||
if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) )
|
||||
{
|
||||
EnableMenuItem(hMainMenu, ID_STOP, MF_ENABLED);
|
||||
|
|
|
@ -167,9 +167,7 @@ CreateProgressDialog(HWND hParent,
|
|||
0,
|
||||
(LPARAM)lpProgStr);
|
||||
|
||||
HeapFree(GetProcessHeap(),
|
||||
0,
|
||||
lpProgStr);
|
||||
LocalFree(lpProgStr);
|
||||
}
|
||||
|
||||
/* Finally, show and update the progress dialog */
|
||||
|
|
|
@ -33,7 +33,6 @@ SetButtonStates(PSERVICEPROPSHEET dlgInfo,
|
|||
{
|
||||
hButton = GetDlgItem(hwndDlg, IDC_START);
|
||||
EnableWindow (hButton, TRUE);
|
||||
HeapFree(GetProcessHeap(), 0, lpServiceConfig);
|
||||
}
|
||||
else if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) )
|
||||
{
|
||||
|
@ -46,6 +45,9 @@ SetButtonStates(PSERVICEPROPSHEET dlgInfo,
|
|||
EnableWindow (hButton, TRUE);
|
||||
}
|
||||
|
||||
if(lpServiceConfig)
|
||||
HeapFree(GetProcessHeap(), 0, lpServiceConfig);
|
||||
|
||||
hButton = GetDlgItem(hwndDlg, IDC_START_PARAM);
|
||||
EnableWindow(hButton, (State == SERVICE_STOPPED));
|
||||
|
||||
|
|
|
@ -270,6 +270,7 @@ GetServiceList(PMAIN_WND_INFO Info,
|
|||
HeapFree(ProcessHeap,
|
||||
0,
|
||||
Info->pAllServices);
|
||||
Info->pAllServices = NULL;
|
||||
}
|
||||
|
||||
ScHandle = OpenSCManager(NULL,
|
||||
|
@ -319,7 +320,7 @@ GetServiceList(PMAIN_WND_INFO Info,
|
|||
if (ScHandle)
|
||||
CloseServiceHandle(ScHandle);
|
||||
|
||||
if (!bRet)
|
||||
if (!bRet && Info->pAllServices)
|
||||
{
|
||||
HeapFree(ProcessHeap,
|
||||
0,
|
||||
|
|
|
@ -163,6 +163,8 @@ AddServiceNamesToStop(HWND hServiceListBox,
|
|||
LB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)lpServiceConfig->lpDisplayName);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, lpServiceConfig);
|
||||
}
|
||||
|
||||
/* Move onto the next string */
|
||||
|
|
Loading…
Reference in a new issue