Minor memory leaks were detected when certain errors had been reported.

Best regards,

Ger


PS: also in this fix: zeroed static data because MSVC2005 does NOT zero 
static data unless specifically instructed to do so (in analysis debug 
builds at least), leading to random data in these structs and fields at 
startup, which will hurt operations.


Diff with fix shown below:

--- ../../1original/xmail/MailSvr.cpp   2007-11-02 01:34:32.000000000 +0100
+++ ./MailSvr.cpp       2007-11-20 01:13:54.000000000 +0100
@@ -145,7 +143,7 @@
 char szMailPath[SYS_MAX_PATH];
 QUEUE_HANDLE hSpoolQueue;
 SYS_SEMAPHORE hSyncSem;
-bool bServerDebug;
+bool bServerDebug = false; /* [i_a] */
 int iFilterTimeout = FILTER_TIMEOUT;
 bool bFilterLogEnabled = false;
 int iLogRotateHours = LOG_ROTATE_HOURS;
@@ -167,19 +165,19 @@
 static int iNumSMAILThreads;
 static int iNumLMAILThreads;
 static SYS_THREAD hCTRLThread;
-static ThreadConfig ThCfgCTRL;
+static ThreadConfig ThCfgCTRL = {0};
 static SYS_THREAD hCTRLSThread;
-static ThreadConfig ThCfgCTRLS;
+static ThreadConfig ThCfgCTRLS = {0};
 static SYS_THREAD hFINGThread;
-static ThreadConfig ThCfgFING;
+static ThreadConfig ThCfgFING = {0};
 static SYS_THREAD hPOP3Thread;
-static ThreadConfig ThCfgPOP3;
+static ThreadConfig ThCfgPOP3 = {0};
 static SYS_THREAD hPOP3SThread;
-static ThreadConfig ThCfgPOP3S;
+static ThreadConfig ThCfgPOP3S = {0};
 static SYS_THREAD hSMTPThread;
-static ThreadConfig ThCfgSMTP;
+static ThreadConfig ThCfgSMTP = {0};
 static SYS_THREAD hSMTPSThread;
-static ThreadConfig ThCfgSMTPS;
+static ThreadConfig ThCfgSMTPS = {0};
 static SYS_THREAD hSMAILThreads[MAX_SMAIL_THREADS];
 static SYS_THREAD hLMAILThreads[MAX_LMAIL_THREADS];
 static SYS_THREAD hPSYNCThread;
@@ -1525,7 +1593,9 @@
 
        if (SysInitLibrary() < 0) {
                ErrorPush();
-               SysEventLog(LOG_LEV_ERROR, "%s\n", ErrGetErrorString());
+               char *pszError = ErrGetErrorStringInfo(ErrGetErrorCode()); /* 
[i_a] */
+               SysLogMessage(LOG_LEV_ERROR, "%s\n", pszError);
+               SysFree(pszError);
                return ErrorPop();
        }
 
@@ -1534,14 +1604,19 @@
 
        if (ppszMergeArgs == NULL) {
                ErrorPush();
-               SysLogMessage(LOG_LEV_ERROR, "%s\n", ErrGetErrorString());
+               char *pszError = ErrGetErrorStringInfo(ErrGetErrorCode()); /* 
[i_a] */
+               SysLogMessage(LOG_LEV_ERROR, "%s\n", pszError);
+               SysFree(pszError);
+               /* SysLogMessage(LOG_LEV_ERROR, "%s\n", ErrGetErrorString()); */
                SysCleanupLibrary();
                return ErrorPop();
        }
 
        if (SvrSetup(iMergeArgsCount, ppszMergeArgs) < 0) {
                ErrorPush();
-               SysLogMessage(LOG_LEV_ERROR, "%s\n", ErrGetErrorString());
+               char *pszError = ErrGetErrorStringInfo(ErrGetErrorCode()); /* 
[i_a] */
+               SysLogMessage(LOG_LEV_ERROR, "%s\n", pszError);
+               SysFree(pszError);
                StrFreeStrings(ppszMergeArgs);
                SysCleanupLibrary();
                return ErrorPop();
@@ -1576,7 +1651,9 @@
 ErrorExit:
        if (iError < 0) {
                iError = ErrGetErrorCode();
-               SysLogMessage(LOG_LEV_ERROR, "%s\n", ErrGetErrorString());
+               char *pszError = ErrGetErrorStringInfo(iError); /* [i_a] */
+               SysLogMessage(LOG_LEV_ERROR, "%s\n", pszError);
+               SysFree(pszError);
        }
        /* Runs shutdown functions */
        SvrDoShutdown();


-
To unsubscribe from this list: send the line "unsubscribe xmail" in
the body of a message to [EMAIL PROTECTED]
For general help: send the line "help" in the body of a message to
[EMAIL PROTECTED]

Reply via email to