aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2016-05-14 20:14:20 -0700
committerGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2016-05-14 20:14:20 -0700
commit35080e72d04e432db061959d1dff4d165a54dbac (patch)
tree1625e7edc0810b624c4bab01c57be520b140dac2
parent5f899396dcb9f8ac9cf6c07e054fe376fc1f77a9 (diff)
Fixed potential crash and memory leaks
-rw-r--r--src/core/basetypes/MCString.cpp4
-rw-r--r--src/objc/imap/MCOIMAPCheckAccountOperation.mm1
-rw-r--r--src/objc/smtp/MCOSMTPOperation.mm1
3 files changed, 5 insertions, 1 deletions
diff --git a/src/core/basetypes/MCString.cpp b/src/core/basetypes/MCString.cpp
index aad82580..991d7963 100644
--- a/src/core/basetypes/MCString.cpp
+++ b/src/core/basetypes/MCString.cpp
@@ -1000,7 +1000,9 @@ void String::appendUTF8CharactersLength(const char * UTF8Characters, unsigned in
void String::appendUTF8Characters(const char * UTF8Characters)
{
- appendUTF8CharactersLength(UTF8Characters, (unsigned int) strlen(UTF8Characters));
+ if (UTF8Characters != NULL) {
+ appendUTF8CharactersLength(UTF8Characters, (unsigned int) strlen(UTF8Characters));
+ }
}
void String::appendCharacters(const UChar * unicodeCharacters)
diff --git a/src/objc/imap/MCOIMAPCheckAccountOperation.mm b/src/objc/imap/MCOIMAPCheckAccountOperation.mm
index 8117df2e..0c6161c4 100644
--- a/src/objc/imap/MCOIMAPCheckAccountOperation.mm
+++ b/src/objc/imap/MCOIMAPCheckAccountOperation.mm
@@ -66,6 +66,7 @@ typedef void (^CompletionType)(NSError *error);
NSMutableDictionary * userInfo = [[error userInfo] mutableCopy];
userInfo[MCOIMAPResponseKey] = MCO_TO_OBJC(op->loginResponse());
error = [NSError errorWithDomain:[error domain] code:[error code] userInfo:userInfo];
+ [userInfo release];
}
_completionBlock(error);
}
diff --git a/src/objc/smtp/MCOSMTPOperation.mm b/src/objc/smtp/MCOSMTPOperation.mm
index 3ff939c6..3bf2af08 100644
--- a/src/objc/smtp/MCOSMTPOperation.mm
+++ b/src/objc/smtp/MCOSMTPOperation.mm
@@ -70,6 +70,7 @@ typedef void (^CompletionType)(NSError *error);
userInfo[MCOSMTPResponseCodeKey] = @(op->lastSMTPResponseCode());
}
error = [NSError errorWithDomain:[error domain] code:[error code] userInfo:userInfo];
+ [userInfo release];
}
}
return error;