From 56ecec5734194ccf709c3f57fe1a15a1b926c68d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 14 Dec 2014 14:33:17 +0000 Subject: let's operator new() clean the memory git-svn-id: http://svn.miranda-ng.org/main/trunk@11406 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/MRA/src/MraMPop.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'protocols/MRA/src/MraMPop.cpp') diff --git a/protocols/MRA/src/MraMPop.cpp b/protocols/MRA/src/MraMPop.cpp index 9796744f29..55f485eae7 100644 --- a/protocols/MRA/src/MraMPop.cpp +++ b/protocols/MRA/src/MraMPop.cpp @@ -11,8 +11,8 @@ struct MRA_MPOP_SESSION_QUEUE : public FIFO_MT struct MRA_MPOP_SESSION_QUEUE_ITEM : public FIFO_MT_ITEM { - LPSTR lpszUrl; /* Url to open. */ - size_t dwUrlSize; + LPSTR lpszUrl; /* Url to open. */ + size_t dwUrlSize; }; void MraMPopSessionQueueClear(HANDLE hMPopSessionQueue); @@ -24,14 +24,10 @@ DWORD MraMPopSessionQueueInitialize(HANDLE *phMPopSessionQueue) if ((*phMPopSessionQueue)) return ERROR_ALREADY_INITIALIZED; - MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)mir_calloc(sizeof(MRA_MPOP_SESSION_QUEUE)); + MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = new MRA_MPOP_SESSION_QUEUE(); if (!pmpsqMPopSessionQueue) return GetLastError(); - pmpsqMPopSessionQueue->bKeyValid = false; - pmpsqMPopSessionQueue->lpszMPOPKey = NULL; - pmpsqMPopSessionQueue->dwMPOPKeySize = 0; - ListMTInitialize(pmpsqMPopSessionQueue); *phMPopSessionQueue = (HANDLE)pmpsqMPopSessionQueue; return NO_ERROR; } @@ -59,8 +55,7 @@ void MraMPopSessionQueueDestroy(HANDLE hMPopSessionQueue) MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hMPopSessionQueue; MraMPopSessionQueueClear(hMPopSessionQueue); - ListMTDestroy(pmpsqMPopSessionQueue); - mir_free(pmpsqMPopSessionQueue); + delete pmpsqMPopSessionQueue; } DWORD CMraProto::MraMPopSessionQueueAddUrl(HANDLE hMPopSessionQueue, const CMStringA &lpszUrl) @@ -149,7 +144,7 @@ void CMraProto::MraMPopSessionQueueFlush(HANDLE hMPopSessionQueue) MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hMPopSessionQueue; MRA_MPOP_SESSION_QUEUE_ITEM *pmpsqi; - while ( FifoMTItemPop(pmpsqMPopSessionQueue, NULL, (LPVOID*)&pmpsqi) == NO_ERROR) { + while (FifoMTItemPop(pmpsqMPopSessionQueue, NULL, (LPVOID*)&pmpsqi) == NO_ERROR) { CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)pmpsqi->lpszUrl); mir_free(pmpsqi); } @@ -170,7 +165,7 @@ DWORD MraMPopSessionQueueSetNewMPopKey(HANDLE hMPopSessionQueue, const CMStringA pmpsqMPopSessionQueue->bKeyValid = true; pmpsqMPopSessionQueue->dwMPOPKeySize = szKey.GetLength(); memcpy(pmpsqMPopSessionQueue->lpszMPOPKey, szKey, szKey.GetLength()); - (*(pmpsqMPopSessionQueue->lpszMPOPKey + szKey.GetLength())) = 0; + *(pmpsqMPopSessionQueue->lpszMPOPKey + szKey.GetLength()) = 0; return NO_ERROR; } -- cgit v1.2.3