summaryrefslogtreecommitdiff
path: root/plugins/YAMN
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-17 11:15:15 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-17 11:15:15 +0000
commit152da8847e828b132c5753ae5f58e8272556d4ef (patch)
tree7c96822b3ea2dee6257071d557259177c11da6f0 /plugins/YAMN
parent79c0e81fbfd1f933a1e251db23dc1fd537ddd239 (diff)
some another leaks fixed
git-svn-id: http://svn.miranda-ng.org/main/trunk@4070 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/YAMN')
-rw-r--r--plugins/YAMN/src/debug.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/plugins/YAMN/src/debug.cpp b/plugins/YAMN/src/debug.cpp
index 1f19975586..c459d0cbb7 100644
--- a/plugins/YAMN/src/debug.cpp
+++ b/plugins/YAMN/src/debug.cpp
@@ -15,7 +15,7 @@
//--------------------------------------------------------------------------------------------------
TCHAR DebugUserDirectory[MAX_PATH] = _T(".");
-LPCRITICAL_SECTION FileAccessCS;
+CRITICAL_SECTION FileAccessCS;
#ifdef DEBUG_SYNCHRO
TCHAR DebugSynchroFileName2[]=_T("%s\\yamn-debug.synchro.log");
@@ -40,11 +40,7 @@ void InitDebug()
#if defined (DEBUG_SYNCHRO) || defined (DEBUG_COMM) || defined (DEBUG_DECODE)
TCHAR DebugFileName[MAX_PATH];
#endif
- if (FileAccessCS==NULL)
- {
- FileAccessCS=new CRITICAL_SECTION;
- InitializeCriticalSection(FileAccessCS);
- }
+ InitializeCriticalSection(&FileAccessCS);
#ifdef DEBUG_SYNCHRO
_stprintf(DebugFileName,DebugSynchroFileName2,DebugUserDirectory);
@@ -70,6 +66,7 @@ void InitDebug()
void UnInitDebug()
{
+ DeleteCriticalSection(&FileAccessCS);
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"File is being closed normally.");
CloseHandle(SynchroFile);
@@ -99,10 +96,10 @@ void DebugLog(HANDLE File,const char *fmt,...)
while(_vsnprintf(str,strsize,fmt,vararg)==-1)
str=(char *)realloc(str,strsize+=65536);
va_end(vararg);
- EnterCriticalSection(FileAccessCS);
+ EnterCriticalSection(&FileAccessCS);
WriteFile(File,tids,(DWORD)strlen(tids),&Written,NULL);
WriteFile(File,str,(DWORD)strlen(str),&Written,NULL);
- LeaveCriticalSection(FileAccessCS);
+ LeaveCriticalSection(&FileAccessCS);
free(str);
}
@@ -120,10 +117,10 @@ void DebugLogW(HANDLE File,const WCHAR *fmt,...)
while(_vsnwprintf(str,strsize,fmt,vararg)==-1)
str=(WCHAR *)realloc(str,(strsize+=65536)*sizeof(WCHAR));
va_end(vararg);
- EnterCriticalSection(FileAccessCS);
+ EnterCriticalSection(&FileAccessCS);
WriteFile(File,tids,(DWORD)strlen(tids),&Written,NULL);
WriteFile(File,str,(DWORD)wcslen(str)*sizeof(WCHAR),&Written,NULL);
- LeaveCriticalSection(FileAccessCS);
+ LeaveCriticalSection(&FileAccessCS);
free(str);
}