adium/adium

Parents 5cc18f2cc797
Children 348b31845008
Fix a couple of issues and silence some other ones that were pointed out by the static analyzer.
--- a/Adium.xcodeproj/project.pbxproj Fri Feb 22 01:47:09 2013 +0100
+++ b/Adium.xcodeproj/project.pbxproj Fri Feb 22 10:51:26 2013 +0100
@@ -12485,6 +12485,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 63C7E02A0FAF9BA800B310AC /* Debug.xcconfig */;
buildSettings = {
+ RUN_CLANG_STATIC_ANALYZER = YES;
};
name = Debug;
};
@@ -12492,6 +12493,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 63C7E02B0FAF9BA800B310AC /* Release.xcconfig */;
buildSettings = {
+ RUN_CLANG_STATIC_ANALYZER = YES;
};
name = Release;
};
@@ -12499,6 +12501,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 63C7E02C0FAF9BA800B310AC /* Release-Debug.xcconfig */;
buildSettings = {
+ RUN_CLANG_STATIC_ANALYZER = YES;
};
name = "Release-Debug";
};
--- a/Frameworks/AIUtilities Framework/Source/AIHostReachabilityMonitor.m Fri Feb 22 01:47:09 2013 +0100
+++ b/Frameworks/AIUtilities Framework/Source/AIHostReachabilityMonitor.m Fri Feb 22 10:51:26 2013 +0100
@@ -605,7 +605,7 @@
kCFRunLoopDefaultMode);
}
- CFRelease(storeRef);
+ if (storeRef) CFRelease(storeRef);
}
}
--- a/Frameworks/AIUtilities Framework/Source/AIScannerAdditions.m Fri Feb 22 01:47:09 2013 +0100
+++ b/Frameworks/AIUtilities Framework/Source/AIScannerAdditions.m Fri Feb 22 10:51:26 2013 +0100
@@ -39,8 +39,14 @@
if (length && (buf[i] == '+')) {
++i;
}
- if (i >= length) return NO;
- if ((buf[i] < '0') || (buf[i] > '9')) return NO;
+ if (i >= length) {
+ free(buf);
+ return NO;
+ }
+ if ((buf[i] < '0') || (buf[i] > '9')) {
+ free(buf);
+ return NO;
+ }
unsigned total = 0;
while (i < length) {
@@ -54,6 +60,7 @@
}
[self setScanLocation:i];
*unsignedIntValue = total;
+ free(buf);
return YES;
}
--- a/Frameworks/AIUtilities Framework/Source/AIStringAdditions.m Fri Feb 22 01:47:09 2013 +0100
+++ b/Frameworks/AIUtilities Framework/Source/AIStringAdditions.m Fri Feb 22 10:51:26 2013 +0100
@@ -585,7 +585,7 @@
do { \
if (i == buflen) { \
buf = realloc(buf, sizeof(unichar) * (buflen += buflenIncrement)); \
- if (!buf) { \
+ if (buf == NULL) { \
NSLog(@"in stringByEscapingForShell: could not allocate %lu bytes", (unsigned long)(sizeof(unichar) * buflen)); \
free(myBuf); \
return nil; \
--- a/Frameworks/Adium Framework/Source/AISoundSet.m Fri Feb 22 01:47:09 2013 +0100
+++ b/Frameworks/Adium Framework/Source/AISoundSet.m Fri Feb 22 10:51:26 2013 +0100
@@ -57,6 +57,7 @@
if ((self = [super init])) {
//Return nil if we can't load our sound set
if (!inPath || ![inPath length] || ![self _loadSoundSetFromPath:inPath]) {
+ [self release];
return nil;
}
--- a/Other/Adium Spotlight Importer/GetMetadataForFile.m Fri Feb 22 01:47:09 2013 +0100
+++ b/Other/Adium Spotlight Importer/GetMetadataForFile.m Fri Feb 22 10:51:26 2013 +0100
@@ -156,6 +156,7 @@
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSData *logData = CopyDataForFile(contentTypeUTI, pathToFile);
CFStringRef textContent = CopyTextContentForFileData(contentTypeUTI, [NSURL fileURLWithPath:(NSString *)pathToFile], logData);
+ [logData release];
[pool release];
return textContent;
--- a/Plugins/Dual Window Interface/AIMessageViewController.m Fri Feb 22 01:47:09 2013 +0100
+++ b/Plugins/Dual Window Interface/AIMessageViewController.m Fri Feb 22 10:51:26 2013 +0100
@@ -1462,6 +1462,8 @@
![chat boolValueForProperty:@"accountJoined"]) {
AIRejoinGroupChatViewController *rejoinChatController = [[AIRejoinGroupChatViewController alloc] init];
[self addTopBarController:rejoinChatController];
+
+ [rejoinChatController release];
}
}
--- a/Plugins/Dual Window Interface/AIMessageWindowController.m Fri Feb 22 01:47:09 2013 +0100
+++ b/Plugins/Dual Window Interface/AIMessageWindowController.m Fri Feb 22 10:51:26 2013 +0100
@@ -680,7 +680,7 @@
AIChat *chat = inTabViewItem.chat;
if ([self.containedChats indexOfObject:chat] != idx) {
- NSMutableArray *cells = [[tabView_tabBar cells] mutableCopy];
+ NSMutableArray *cells = [[[tabView_tabBar cells] mutableCopy] autorelease];
[cells moveObject:[cells objectAtIndex:[[tabView_tabBar representedTabViewItems] indexOfObject:inTabViewItem]] toIndex:idx];
[tabView_tabBar setNeedsDisplay:YES];
--- a/Plugins/Purple Service/ESPurpleJabberAccount.m Fri Feb 22 01:47:09 2013 +0100
+++ b/Plugins/Purple Service/ESPurpleJabberAccount.m Fri Feb 22 10:51:26 2013 +0100
@@ -474,7 +474,7 @@
shouldAttemptReconnect = AIReconnectImmediately;
}
#ifdef HAVE_CDSA
- else if (purple_account_get_bool([self purpleAccount],PURPLE_SSL_CDSA_BUGGY_TLS_WORKAROUND,false) &&
+ else if (purple_account_get_bool([self purpleAccount],PURPLE_SSL_CDSA_BUGGY_TLS_WORKAROUND,false) && disconnectionError &&
[*disconnectionError isEqualToString:[NSString stringWithUTF8String:_("SSL Handshake Failed")]]) {
AILog(@"%@: Reconnecting immediately to try to work around buggy TLS stacks",self);
shouldAttemptReconnect = AIReconnectNormally;
--- a/Plugins/Twitter Plugin/MGTwitterEngine/NSData+Base64.m Fri Feb 22 01:47:09 2013 +0100
+++ b/Plugins/Twitter Plugin/MGTwitterEngine/NSData+Base64.m Fri Feb 22 10:51:26 2013 +0100
@@ -32,7 +32,8 @@
unsigned long ixtext = 0;
unsigned long lentext = 0;
unsigned char ch = 0;
- unsigned char inbuf[4], outbuf[4];
+ unsigned char inbuf[4] = {0};
+ unsigned char outbuf[4];
short i = 0, ixinbuf = 0;
BOOL flignore = NO;
BOOL flendtext = NO;
--- a/Source/AIContactListUserPictureMenuController.m Fri Feb 22 01:47:09 2013 +0100
+++ b/Source/AIContactListUserPictureMenuController.m Fri Feb 22 10:51:26 2013 +0100
@@ -62,6 +62,7 @@
*/
- (id)initWithNibName:(NSString *)nibName imagePicker:(AIContactListImagePicker *)picker
{
+ self = [super init];
if ([[NSBundle mainBundle] loadNibFile:nibName
externalNameTable:[NSDictionary dictionaryWithObjectsAndKeys:self, NSNibOwner, AI_topLevelObjects, NSNibTopLevelObjects, nil]
withZone:nil]) {
--- a/Source/AIEmoticonController.m Fri Feb 22 01:47:09 2013 +0100
+++ b/Source/AIEmoticonController.m Fri Feb 22 10:51:26 2013 +0100
@@ -225,7 +225,7 @@
BOOL currentLocationNeedsUpdate = YES;
if ([candidateEmoticons count]) {
- NSString *replacementString;
+ NSString *replacementString = nil;
NSMutableAttributedString *replacement;
NSInteger textLength;
NSRange emoticonRangeInNewMessage;
--- a/Source/AILogViewerWindowController.m Fri Feb 22 01:47:09 2013 +0100
+++ b/Source/AILogViewerWindowController.m Fri Feb 22 10:51:26 2013 +0100
@@ -122,7 +122,7 @@
- (void)outlineViewSelectionDidChangeDelayed;
- (void)openChatOnDoubleAction:(id)sender;
-- (void)deleteLogsAlertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
+- (void)deleteLogsAlertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(NSArray *)__attribute__((ns_consumed)) contextInfo;
NSInteger compareRectLocation(id obj1, id obj2, void *context);
- (void)setNavBarHidden:(NSNumber *)hide;
@@ -2605,7 +2605,7 @@
[self rebuildIndices];
}
-- (void)deleteLogsAlertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
+- (void)deleteLogsAlertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(NSArray *)__attribute__((ns_consumed)) contextInfo;
{
NSArray *selectedLogs = (NSArray *)contextInfo;
if (returnCode == NSAlertFirstButtonReturn) {
--- a/Source/AIPreferenceWindowController.m Fri Feb 22 01:47:09 2013 +0100
+++ b/Source/AIPreferenceWindowController.m Fri Feb 22 10:51:26 2013 +0100
@@ -547,6 +547,8 @@
[_trackingAreas addObject:tA];
y -= SUGGESTION_ENTRY_HEIGHT;
+
+ [item release];
}
[suggestionsWindow setFrame:frame display:NO];