adium 5358:4872b03baf9c: Fix a couple of issues and silence some...

commits at adium.im commits at adium.im
Fri Feb 22 09:51:41 UTC 2013


details:	http://hg.adium.im/adium/rev/4872b03baf9c
revision:	5358:4872b03baf9c
branch:		adium-1.6
author:		Thijs Alkemade <me at thijsalkema.de>
date:		Fri Feb 22 10:51:26 2013 +0100

Fix a couple of issues and silence some other ones that were pointed out by the static analyzer.

diffs (206 lines):

diff -r 5cc18f2cc797 -r 4872b03baf9c Adium.xcodeproj/project.pbxproj
--- 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";
 		};
diff -r 5cc18f2cc797 -r 4872b03baf9c Frameworks/AIUtilities Framework/Source/AIHostReachabilityMonitor.m
--- 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);
 	}
 }
 
diff -r 5cc18f2cc797 -r 4872b03baf9c Frameworks/AIUtilities Framework/Source/AIScannerAdditions.m
--- 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;
 }
 
diff -r 5cc18f2cc797 -r 4872b03baf9c Frameworks/AIUtilities Framework/Source/AIStringAdditions.m
--- 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; \
diff -r 5cc18f2cc797 -r 4872b03baf9c Frameworks/Adium Framework/Source/AISoundSet.m
--- 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;
 		}
 
diff -r 5cc18f2cc797 -r 4872b03baf9c Other/Adium Spotlight Importer/GetMetadataForFile.m
--- 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;
diff -r 5cc18f2cc797 -r 4872b03baf9c Plugins/Dual Window Interface/AIMessageViewController.m
--- 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];
 	}
 }
 
diff -r 5cc18f2cc797 -r 4872b03baf9c Plugins/Dual Window Interface/AIMessageWindowController.m
--- 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];
diff -r 5cc18f2cc797 -r 4872b03baf9c Plugins/Purple Service/ESPurpleJabberAccount.m
--- 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;
diff -r 5cc18f2cc797 -r 4872b03baf9c Plugins/Twitter Plugin/MGTwitterEngine/NSData+Base64.m
--- 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;
diff -r 5cc18f2cc797 -r 4872b03baf9c Source/AIContactListUserPictureMenuController.m
--- 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]) {
diff -r 5cc18f2cc797 -r 4872b03baf9c Source/AIEmoticonController.m
--- 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;
diff -r 5cc18f2cc797 -r 4872b03baf9c Source/AILogViewerWindowController.m
--- 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) {
diff -r 5cc18f2cc797 -r 4872b03baf9c Source/AIPreferenceWindowController.m
--- 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];




More information about the commits mailing list