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)
|
if(hFile != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
TCHAR LVText[500];
|
TCHAR LVText[500];
|
||||||
TCHAR newl = _T('\n');
|
TCHAR newl[2] = {_T('\r'), _T('\n')};
|
||||||
TCHAR tab = _T('\t');
|
TCHAR tab = _T('\t');
|
||||||
DWORD dwTextLength, dwWritten;
|
DWORD dwTextLength, dwWritten;
|
||||||
INT NumListedServ = 0;
|
INT NumListedServ = 0;
|
||||||
|
@ -68,7 +68,7 @@ SaveServicesToFile(PMAIN_WND_INFO Info,
|
||||||
LVText,
|
LVText,
|
||||||
i,
|
i,
|
||||||
k);
|
k);
|
||||||
if (LVText != NULL)
|
if (_tcslen(LVText))
|
||||||
{
|
{
|
||||||
WriteFile(hFile,
|
WriteFile(hFile,
|
||||||
LVText,
|
LVText,
|
||||||
|
@ -84,8 +84,8 @@ SaveServicesToFile(PMAIN_WND_INFO Info,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WriteFile(hFile,
|
WriteFile(hFile,
|
||||||
&newl,
|
newl,
|
||||||
sizeof(TCHAR),
|
sizeof(newl),
|
||||||
&dwWritten,
|
&dwWritten,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,10 +204,11 @@ VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info)
|
||||||
SendMessage(Info->hTool, TB_SETSTATE, ID_RESTART,
|
SendMessage(Info->hTool, TB_SETSTATE, ID_RESTART,
|
||||||
(LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
|
(LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, lpServiceConfig);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(lpServiceConfig)
|
||||||
|
HeapFree(GetProcessHeap(), 0, lpServiceConfig);
|
||||||
|
|
||||||
if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) )
|
if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) )
|
||||||
{
|
{
|
||||||
EnableMenuItem(hMainMenu, ID_STOP, MF_ENABLED);
|
EnableMenuItem(hMainMenu, ID_STOP, MF_ENABLED);
|
||||||
|
|
|
@ -167,9 +167,7 @@ CreateProgressDialog(HWND hParent,
|
||||||
0,
|
0,
|
||||||
(LPARAM)lpProgStr);
|
(LPARAM)lpProgStr);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(),
|
LocalFree(lpProgStr);
|
||||||
0,
|
|
||||||
lpProgStr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Finally, show and update the progress dialog */
|
/* Finally, show and update the progress dialog */
|
||||||
|
|
|
@ -33,7 +33,6 @@ SetButtonStates(PSERVICEPROPSHEET dlgInfo,
|
||||||
{
|
{
|
||||||
hButton = GetDlgItem(hwndDlg, IDC_START);
|
hButton = GetDlgItem(hwndDlg, IDC_START);
|
||||||
EnableWindow (hButton, TRUE);
|
EnableWindow (hButton, TRUE);
|
||||||
HeapFree(GetProcessHeap(), 0, lpServiceConfig);
|
|
||||||
}
|
}
|
||||||
else if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) )
|
else if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) )
|
||||||
{
|
{
|
||||||
|
@ -46,6 +45,9 @@ SetButtonStates(PSERVICEPROPSHEET dlgInfo,
|
||||||
EnableWindow (hButton, TRUE);
|
EnableWindow (hButton, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(lpServiceConfig)
|
||||||
|
HeapFree(GetProcessHeap(), 0, lpServiceConfig);
|
||||||
|
|
||||||
hButton = GetDlgItem(hwndDlg, IDC_START_PARAM);
|
hButton = GetDlgItem(hwndDlg, IDC_START_PARAM);
|
||||||
EnableWindow(hButton, (State == SERVICE_STOPPED));
|
EnableWindow(hButton, (State == SERVICE_STOPPED));
|
||||||
|
|
||||||
|
|
|
@ -270,6 +270,7 @@ GetServiceList(PMAIN_WND_INFO Info,
|
||||||
HeapFree(ProcessHeap,
|
HeapFree(ProcessHeap,
|
||||||
0,
|
0,
|
||||||
Info->pAllServices);
|
Info->pAllServices);
|
||||||
|
Info->pAllServices = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScHandle = OpenSCManager(NULL,
|
ScHandle = OpenSCManager(NULL,
|
||||||
|
@ -319,7 +320,7 @@ GetServiceList(PMAIN_WND_INFO Info,
|
||||||
if (ScHandle)
|
if (ScHandle)
|
||||||
CloseServiceHandle(ScHandle);
|
CloseServiceHandle(ScHandle);
|
||||||
|
|
||||||
if (!bRet)
|
if (!bRet && Info->pAllServices)
|
||||||
{
|
{
|
||||||
HeapFree(ProcessHeap,
|
HeapFree(ProcessHeap,
|
||||||
0,
|
0,
|
||||||
|
|
|
@ -163,6 +163,8 @@ AddServiceNamesToStop(HWND hServiceListBox,
|
||||||
LB_ADDSTRING,
|
LB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)lpServiceConfig->lpDisplayName);
|
(LPARAM)lpServiceConfig->lpDisplayName);
|
||||||
|
|
||||||
|
HeapFree(GetProcessHeap(), 0, lpServiceConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move onto the next string */
|
/* Move onto the next string */
|
||||||
|
|
Loading…
Reference in a new issue