Fixed memory leaks.
This commit is contained in:
parent
57ba0cb660
commit
3351a66f51
|
@ -540,13 +540,15 @@ WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
|
||||||
// users on NT can use `--daemon' or `--no-daemon' to force us out
|
// users on NT can use `--daemon' or `--no-daemon' to force us out
|
||||||
// of the service code path.
|
// of the service code path.
|
||||||
if (__argc <= 1 && !CArchMiscWindows::isWindows95Family()) {
|
if (__argc <= 1 && !CArchMiscWindows::isWindows95Family()) {
|
||||||
|
int result = kExitFailed;
|
||||||
try {
|
try {
|
||||||
return ARCH->daemonize(DAEMON_NAME, &daemonStartup);
|
result = ARCH->daemonize(DAEMON_NAME, &daemonStartup);
|
||||||
}
|
}
|
||||||
catch (XArchDaemon& e) {
|
catch (XArchDaemon& e) {
|
||||||
LOG((CLOG_CRIT "failed to start as a service: %s" BYE, e.what().c_str(), ARG->m_pname));
|
LOG((CLOG_CRIT "failed to start as a service: %s" BYE, e.what().c_str(), ARG->m_pname));
|
||||||
return kExitFailed;
|
|
||||||
}
|
}
|
||||||
|
delete CLOG;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse command line
|
// parse command line
|
||||||
|
@ -586,6 +588,7 @@ WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
|
||||||
MessageBox(NULL, msg, ARG->m_pname, MB_OK | MB_ICONWARNING);
|
MessageBox(NULL, msg, ARG->m_pname, MB_OK | MB_ICONWARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete CLOG;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -672,13 +672,15 @@ WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
|
||||||
// users on NT can use `--daemon' or `--no-daemon' to force us out
|
// users on NT can use `--daemon' or `--no-daemon' to force us out
|
||||||
// of the service code path.
|
// of the service code path.
|
||||||
if (__argc <= 1 && !CArchMiscWindows::isWindows95Family()) {
|
if (__argc <= 1 && !CArchMiscWindows::isWindows95Family()) {
|
||||||
|
int result = kExitFailed;
|
||||||
try {
|
try {
|
||||||
return ARCH->daemonize(DAEMON_NAME, &daemonStartup);
|
result = ARCH->daemonize(DAEMON_NAME, &daemonStartup);
|
||||||
}
|
}
|
||||||
catch (XArchDaemon& e) {
|
catch (XArchDaemon& e) {
|
||||||
LOG((CLOG_CRIT "failed to start as a service: %s" BYE, e.what().c_str(), ARG->m_pname));
|
LOG((CLOG_CRIT "failed to start as a service: %s" BYE, e.what().c_str(), ARG->m_pname));
|
||||||
return kExitFailed;
|
|
||||||
}
|
}
|
||||||
|
delete CLOG;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse command line
|
// parse command line
|
||||||
|
@ -721,6 +723,7 @@ WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
|
||||||
MessageBox(NULL, msg, ARG->m_pname, MB_OK | MB_ICONWARNING);
|
MessageBox(NULL, msg, ARG->m_pname, MB_OK | MB_ICONWARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete CLOG;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,15 @@ CArchMultithreadWindows::CArchMultithreadWindows()
|
||||||
CArchMultithreadWindows::~CArchMultithreadWindows()
|
CArchMultithreadWindows::~CArchMultithreadWindows()
|
||||||
{
|
{
|
||||||
s_instance = NULL;
|
s_instance = NULL;
|
||||||
|
|
||||||
|
// clean up thread list
|
||||||
|
for (CThreadList::iterator index = m_threadList.begin();
|
||||||
|
index != m_threadList.end(); ++index) {
|
||||||
|
delete *index;
|
||||||
|
}
|
||||||
|
|
||||||
|
// done with mutex
|
||||||
|
delete m_threadMutex;
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE
|
HANDLE
|
||||||
|
|
|
@ -406,6 +406,7 @@ CUnicode::textToUTF8(const CString& src, bool* errors)
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
delete[] wcs;
|
delete[] wcs;
|
||||||
|
ARCH->closeMBState(state);
|
||||||
|
|
||||||
return utf8;
|
return utf8;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue