fix some bugs reported by the clang static analyzer

CQTexperiment
vurlix 2008-08-26 17:45:16 +00:00
parent 5132465651
commit 38e6e9af62
7 changed files with 18 additions and 8 deletions

View File

@ -137,11 +137,11 @@ addressForHost(NSString *hostname)
}
buffer[bytesRead] = '\0';
result = [[NSString alloc] initWithUTF8String:buffer];
result = [[[NSString alloc] autorelease] initWithUTF8String:buffer];
} while(keepGoing);
return [result autorelease];
return result;
}
- (void) shutdown

View File

@ -67,6 +67,8 @@ static void myFSEventCallback(
kFSEventStreamCreateFlagNone // Watch this and all its subdirectories
);
CFRelease(pathsToWatch);
FSEventStreamScheduleWithRunLoop(stream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
FSEventStreamStart(stream);

View File

@ -71,7 +71,7 @@
NSScanner *scanner = nil;
BOOL result = NO;
int value = 0;
unsigned seconds;
unsigned seconds = 0;
scanner = [NSScanner scannerWithString:string];

View File

@ -37,7 +37,9 @@
NSString *basePath = [[[baseFilename stringByStandardizingPath] stringByDeletingLastPathComponent] stringByAppendingString:@"/"];
[unixPath insertString:basePath atIndex:0];
}
return [NSURL URLWithString:[[NSURL fileURLWithPath:unixPath] absoluteString]];
NSURL *url = [NSURL URLWithString:[[NSURL fileURLWithPath:unixPath] absoluteString]];
[unixPath release];
return url;
}
-initWithFile:(NSString*)filename {
@ -56,7 +58,7 @@
NSLog(@"Cannot read header");
return nil;
}
NSString* str = [[NSString alloc] initWithData:da encoding: NSASCIIStringEncoding];
NSString* str = [[[NSString alloc] autorelease] initWithData:da encoding: NSASCIIStringEncoding];
if([str compare:header options:NSCaseInsensitiveSearch]) {
NSLog(@"APL header mismatch");
return nil;

View File

@ -54,7 +54,9 @@
}
//Append the fragment
return [NSURL URLWithString:[[[NSURL fileURLWithPath:unixPath] absoluteString] stringByAppendingString: fragment]];
NSURL *url = [NSURL URLWithString:[[[NSURL fileURLWithPath:unixPath] absoluteString] stringByAppendingString: fragment]];
[unixPath release];
return url;
}

View File

@ -58,7 +58,9 @@
}
//Append the fragment
return [NSURL URLWithString:[[[NSURL fileURLWithPath:unixPath] absoluteString] stringByAppendingString: fragment]];
NSURL *url = [NSURL URLWithString:[[[NSURL fileURLWithPath:unixPath] absoluteString] stringByAppendingString: fragment]];
[unixPath release];
return url;
}
+ (NSArray *)urlsForContainerURL:(NSURL *)url

View File

@ -58,7 +58,9 @@
}
//Append the fragment
return [NSURL URLWithString:[[[NSURL fileURLWithPath:unixPath] absoluteString] stringByAppendingString: fragment]];
NSURL *url = [NSURL URLWithString:[[[NSURL fileURLWithPath:unixPath] absoluteString] stringByAppendingString: fragment]];
[unixPath release];
return url;
}