Permalink
Browse files

all but a few places use the typical [[[foo alloc] init] autorelease]…

… pattern, removed 3 explicit releases and use autorelease instead. There are now only 2 exceptions to this pattern left. One is probably justified, the other looks like a leak.
  • Loading branch information...
Sean McBride Sean McBride
Sean McBride authored and Sean McBride committed Jan 1, 2010
1 parent dab8a36 commit b21b3082031e0603d4ea1635224cf275b4237d3c
Showing with 3 additions and 7 deletions.
  1. +2 −5 SUAppcast.m
  2. +1 −2 SUStandardVersionComparator.m
View
@@ -60,7 +60,7 @@ - (void)downloadDidFinish:(NSURLDownload *)download
CFRelease(download);
NSError *error = nil;
- NSXMLDocument *document = [[NSXMLDocument alloc] initWithContentsOfURL:[NSURL fileURLWithPath:downloadFilename] options:0 error:&error];
+ NSXMLDocument *document = [[[NSXMLDocument alloc] initWithContentsOfURL:[NSURL fileURLWithPath:downloadFilename] options:0 error:&error] autorelease];
BOOL failed = NO;
NSArray *xmlItems = nil;
NSMutableArray *appcastItems = [NSMutableArray array];
@@ -148,11 +148,10 @@ - (void)downloadDidFinish:(NSURLDownload *)download
}
NSString *errString;
- SUAppcastItem *anItem = [[SUAppcastItem alloc] initWithDictionary:dict failureReason:&errString];
+ SUAppcastItem *anItem = [[[SUAppcastItem alloc] initWithDictionary:dict failureReason:&errString] autorelease];
if (anItem)
{
[appcastItems addObject:anItem];
- [anItem release];
}
else
{
@@ -162,8 +161,6 @@ - (void)downloadDidFinish:(NSURLDownload *)download
[dict removeAllObjects];
}
}
-
- [document release];
if ([appcastItems count])
{
@@ -55,9 +55,8 @@ - (NSArray *)splitVersionString:(NSString *)version
newType = [self typeOfCharacter:character];
if (oldType != newType || oldType == kPeriodType) {
// We've reached a new segment
- NSString *aPart = [[NSString alloc] initWithString:s];
+ NSString *aPart = [[[NSString alloc] initWithString:s] autorelease];
[parts addObject:aPart];
- [aPart release];
[s setString:character];
} else {
// Add character to string and continue

0 comments on commit b21b308

Please sign in to comment.