From 53e9e2e4cb7ab3c9b40b40218ca3e109ab908694 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 21 Mar 2013 18:47:29 +0000 Subject: handle leak in ICQ git-svn-id: http://svn.miranda-ng.org/main/trunk@4153 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/IcqOscarJ/src/fam_01service.cpp | 2 +- protocols/IcqOscarJ/src/icq_avatar.h | 2 +- protocols/IcqOscarJ/src/icq_rates.cpp | 13 +++++-------- protocols/IcqOscarJ/src/icq_server.cpp | 9 ++++----- 4 files changed, 11 insertions(+), 15 deletions(-) (limited to 'protocols') diff --git a/protocols/IcqOscarJ/src/fam_01service.cpp b/protocols/IcqOscarJ/src/fam_01service.cpp index 4439dd85b5..c9f87e1e89 100644 --- a/protocols/IcqOscarJ/src/fam_01service.cpp +++ b/protocols/IcqOscarJ/src/fam_01service.cpp @@ -87,7 +87,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header #ifdef _DEBUG NetLog_Server("Sending Rate Info Ack"); #endif - m_rates->initAckPacket(&packet); + m_rates->initAckPacket(&packet); sendServPacket(&packet); /* CLI_REQINFO - This command requests from the server certain information about the client that is stored on the server. */ diff --git a/protocols/IcqOscarJ/src/icq_avatar.h b/protocols/IcqOscarJ/src/icq_avatar.h index 6bfcb65c45..954dd28226 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.h +++ b/protocols/IcqOscarJ/src/icq_avatar.h @@ -67,7 +67,7 @@ protected: void handleAvatarFam(BYTE *pBuffer, WORD wBufferLength, snac_header *pSnacHeader); rates *m_rates; - icq_critical_section *m_ratesMutex; + icq_critical_section *m_ratesMutex; int NetLog_Server(const char *fmt,...); diff --git a/protocols/IcqOscarJ/src/icq_rates.cpp b/protocols/IcqOscarJ/src/icq_rates.cpp index cfe8a9508f..55ac226d31 100644 --- a/protocols/IcqOscarJ/src/icq_rates.cpp +++ b/protocols/IcqOscarJ/src/icq_rates.cpp @@ -492,8 +492,7 @@ void rates_queue::putItem(rates_queue_item *pItem, int nMinDelay) if (nDelay < nMinDelay) nDelay = nMinDelay; initDelay(nDelay, &rates_queue::processQueue); } - else - listsMutex->Leave(); + else listsMutex->Leave(); } @@ -502,8 +501,7 @@ int CIcqProto::handleRateItem(rates_queue_item *item, int nQueueType, int nMinDe rates_queue *pQueue = NULL; m_ratesMutex->Enter(); - switch (nQueueType) - { + switch (nQueueType) { case RQT_REQUEST: pQueue = m_ratesQueue_Request; break; @@ -512,10 +510,9 @@ int CIcqProto::handleRateItem(rates_queue_item *item, int nQueueType, int nMinDe break; } - if (pQueue) - { - if (bAllowDelay && (item->isOverRate(pQueue->waitLevel) || nMinDelay)) - { // limit reached or min delay configured, add to queue + if (pQueue) { + if (bAllowDelay && (item->isOverRate(pQueue->waitLevel) || nMinDelay)) { + // limit reached or min delay configured, add to queue pQueue->putItem(item, nMinDelay); m_ratesMutex->Leave(); diff --git a/protocols/IcqOscarJ/src/icq_server.cpp b/protocols/IcqOscarJ/src/icq_server.cpp index 63a5d63d84..6ddaea9bdb 100644 --- a/protocols/IcqOscarJ/src/icq_server.cpp +++ b/protocols/IcqOscarJ/src/icq_server.cpp @@ -221,9 +221,9 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) { icq_lock l(m_ratesMutex); - SAFE_DELETE((MZeroedObject**)&m_ratesQueue_Request); - SAFE_DELETE((MZeroedObject**)&m_ratesQueue_Response); - SAFE_DELETE((MZeroedObject**)&m_rates); + delete m_ratesQueue_Request; m_ratesQueue_Request = NULL; + delete m_ratesQueue_Response; m_ratesQueue_Response = NULL; + delete m_rates; m_rates = NULL; } FlushServerIDs(); // clear server IDs list @@ -394,8 +394,7 @@ int CIcqProto::IsServerOverRate(WORD wFamily, WORD wCommand, int nLevel) { icq_lock l(m_ratesMutex); - if (m_rates) - { + if (m_rates) { WORD wGroup = m_rates->getGroupFromSNAC(wFamily, wCommand); // check if the rate is not over specified level -- cgit v1.2.3