adium 4579:1012b2cbbfaa: Fix a couple of leaks found by the stat...
commits at adium.im
commits at adium.im
Sat Jan 28 23:36:35 UTC 2012
details: http://hg.adium.im/adium/rev/1012b2cbbfaa
revision: 4579:1012b2cbbfaa
branch: (none)
author: Thijs Alkemade <thijsalkemade at gmail.com>
date: Sun Jan 29 00:34:28 2012 +0100
Fix a couple of leaks found by the static analyzer in the initialization of the AILoggerPlugin.
Subject: adium 4580:d3b8bf1f2451: Fix leaks in the deallocation of AIMetaContacts, found (partially) by the static analyzer.
details: http://hg.adium.im/adium/rev/d3b8bf1f2451
revision: 4580:d3b8bf1f2451
branch: (none)
author: Thijs Alkemade <thijsalkemade at gmail.com>
date: Sun Jan 29 00:36:10 2012 +0100
Fix leaks in the deallocation of AIMetaContacts, found (partially) by the static analyzer.
diffs (70 lines):
diff -r 0016b375a750 -r d3b8bf1f2451 Frameworks/Adium Framework/Source/AIMetaContact.m
--- a/Frameworks/Adium Framework/Source/AIMetaContact.m Sun Jan 29 00:27:00 2012 +0200
+++ b/Frameworks/Adium Framework/Source/AIMetaContact.m Sun Jan 29 00:36:10 2012 +0100
@@ -80,7 +80,9 @@
//I've seen a crashlog with a delayed -updateDisplayName causing crashes due to a freed AIMetaContact, so let's cancel any pending updates
[[NSRunLoop currentRunLoop] cancelPerformSelectorsWithTarget:self];
- [self.containedObjects release];
+ [_containedObjects release]; _containedObjects = nil;
+ [_listContacts release]; _listContacts = nil;
+ [_listContactsIncludingOfflineAccounts release]; _listContactsIncludingOfflineAccounts = nil;
[super dealloc];
}
diff -r 0016b375a750 -r d3b8bf1f2451 Source/AILoggerPlugin.m
--- a/Source/AILoggerPlugin.m Sun Jan 29 00:27:00 2012 +0200
+++ b/Source/AILoggerPlugin.m Sun Jan 29 00:36:10 2012 +0100
@@ -225,21 +225,22 @@
logLoadingPrefetchSemaphore = dispatch_semaphore_create(3 * cpuCount + 1); //prefetch one log
- self.xhtmlDecoder = [[AIHTMLDecoder alloc] initWithHeaders:NO
- fontTags:YES
- closeFontTags:YES
- colorTags:YES
- styleTags:YES
- encodeNonASCII:YES
- encodeSpaces:NO
- attachmentsAsText:NO
- onlyIncludeOutgoingImages:NO
- simpleTagsOnly:NO
- bodyBackground:NO
- allowJavascriptURLs:YES];
+ self.xhtmlDecoder = [[[AIHTMLDecoder alloc] initWithHeaders:NO
+ fontTags:YES
+ closeFontTags:YES
+ colorTags:YES
+ styleTags:YES
+ encodeNonASCII:YES
+ encodeSpaces:NO
+ attachmentsAsText:NO
+ onlyIncludeOutgoingImages:NO
+ simpleTagsOnly:NO
+ bodyBackground:NO
+ allowJavascriptURLs:YES] autorelease];
+
[self.xhtmlDecoder setGeneratesStrictXHTML:YES];
- self.statusTranslation = [[NSDictionary alloc] initWithObjectsAndKeys:
+ self.statusTranslation = [NSDictionary dictionaryWithObjectsAndKeys:
@"away",@"away",
@"online",@"return_away",
@"online",@"online",
@@ -324,6 +325,7 @@
self.dirtyLogSet = nil;
self.activeAppenders = nil;
self.xhtmlDecoder = nil;
+ self.statusTranslation = nil;
dispatch_release(dirtyLogSetMutationQueue); dirtyLogSetMutationQueue = nil;
dispatch_release(searchIndexQueue); searchIndexQueue = nil;
@@ -1546,7 +1548,7 @@
}));
} else {
AILogWithSignature(@"Could not create document for %@ [%@]",logPath,[NSURL fileURLWithPath:logPath]);
- CFRelease(document);
+ if (document) CFRelease(document);
OSAtomicIncrement64Barrier((int64_t *)&(bself->logsIndexed));
OSAtomicIncrement32Barrier((int32_t *)&unsavedChanges);
dispatch_semaphore_signal(jobSemaphore);
More information about the commits
mailing list