diff options
author | Alexander Belyavskiy <diejmon@gmail.com> | 2019-03-25 20:26:44 +0300 |
---|---|---|
committer | HoĆ V. DINH <dinh.viet.hoa@gmail.com> | 2019-03-25 10:26:44 -0700 |
commit | 58473736aa31e57ed94c7ab6221af8def5839ca1 (patch) | |
tree | b6f3e4fad011fac603ba00a2846d48f8e3cac42a | |
parent | c4a2e84c3b6dbfd34ecd9d1f44cf032b437139fd (diff) |
Fix few memory leaks (#1804)
* Fix memory leaks
-rw-r--r-- | src/core/imap/MCIMAPSession.cpp | 1 | ||||
-rw-r--r-- | src/core/nntp/MCNNTPSession.cpp | 1 | ||||
-rw-r--r-- | src/core/provider/MCMailProvidersManager.cpp | 4 | ||||
-rw-r--r-- | src/core/provider/MCMailProvidersManager.h | 1 | ||||
-rw-r--r-- | src/objc/imap/MCOIMAPFetchFoldersOperation.mm | 2 |
5 files changed, 8 insertions, 1 deletions
diff --git a/src/core/imap/MCIMAPSession.cpp b/src/core/imap/MCIMAPSession.cpp index 9b0e6a66..e72576d1 100644 --- a/src/core/imap/MCIMAPSession.cpp +++ b/src/core/imap/MCIMAPSession.cpp @@ -3024,6 +3024,7 @@ void IMAPSession::fetchMessageAttachmentToFileByChunksByUID(String * folder, uin } if (data == NULL) { + pool->release(); break; } diff --git a/src/core/nntp/MCNNTPSession.cpp b/src/core/nntp/MCNNTPSession.cpp index ae383581..7e0018e6 100644 --- a/src/core/nntp/MCNNTPSession.cpp +++ b/src/core/nntp/MCNNTPSession.cpp @@ -499,6 +499,7 @@ Data * NNTPSession::fetchArticleByMessageID(String * messageID, ErrorCode * pErr msgID = strdup(messageID->UTF8Characters()); r = newsnntp_article_by_message_id(mNNTP, msgID, &content, &content_len); + free(msgID); if (r == NEWSNNTP_ERROR_STREAM) { * pError = ErrorConnection; return NULL; diff --git a/src/core/provider/MCMailProvidersManager.cpp b/src/core/provider/MCMailProvidersManager.cpp index a5f7891a..f802d7ff 100644 --- a/src/core/provider/MCMailProvidersManager.cpp +++ b/src/core/provider/MCMailProvidersManager.cpp @@ -21,6 +21,10 @@ MailProvidersManager::MailProvidersManager() { init(); } +MailProvidersManager::~MailProvidersManager() { + MC_SAFE_RELEASE(mProviders); +} + MailProvidersManager * MailProvidersManager::sharedManager() { static MailProvidersManager * instance = new MailProvidersManager(); diff --git a/src/core/provider/MCMailProvidersManager.h b/src/core/provider/MCMailProvidersManager.h index 774c2d30..88723563 100644 --- a/src/core/provider/MCMailProvidersManager.h +++ b/src/core/provider/MCMailProvidersManager.h @@ -30,6 +30,7 @@ namespace mailcore { private: MailProvidersManager(); + ~MailProvidersManager(); void registerProviders(HashMap * providers); HashMap * mProviders; diff --git a/src/objc/imap/MCOIMAPFetchFoldersOperation.mm b/src/objc/imap/MCOIMAPFetchFoldersOperation.mm index b0965401..97e3ae6c 100644 --- a/src/objc/imap/MCOIMAPFetchFoldersOperation.mm +++ b/src/objc/imap/MCOIMAPFetchFoldersOperation.mm @@ -43,7 +43,7 @@ typedef void (^CompletionType)(NSError *error, NSArray *folder); [super dealloc]; } -- (void) start:(void (^)(NSError *error, NSArray * /* MCOIMAPFolder */ folders))completionBlock +- (void) start:(void (^)(NSError *error, NSArray<MCOIMAPFolder *> *folders))completionBlock { _completionBlock = [completionBlock copy]; [self start]; |