aboutsummaryrefslogtreecommitdiffstats
path: root/Source/CMTextView.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-03-13 20:41:36 +0000
committerrowanbeentje <rowan@beent.je>2010-03-13 20:41:36 +0000
commitda87ee2564f73d7f578ffb08e5d03073ce49d694 (patch)
tree6b5a2e11798787e8614779c47611e506daff25b7 /Source/CMTextView.m
parent4b13d761590d65d2b294aaa6c17654edbd0a811e (diff)
downloadsequelpro-da87ee2564f73d7f578ffb08e5d03073ce49d694.tar.gz
sequelpro-da87ee2564f73d7f578ffb08e5d03073ce49d694.tar.bz2
sequelpro-da87ee2564f73d7f578ffb08e5d03073ce49d694.zip
- Fix some leaks and autoreleases after checking static analysis
Diffstat (limited to 'Source/CMTextView.m')
-rw-r--r--Source/CMTextView.m13
1 files changed, 6 insertions, 7 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index 045c8ab6..6e55ec6b 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -311,7 +311,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
[allDbs addObject:db];
NSSortDescriptor *desc = [[NSSortDescriptor alloc] initWithKey:nil ascending:YES selector:@selector(localizedCompare:)];
- NSMutableArray *sortedDbs = [[NSMutableArray array] autorelease];
+ NSMutableArray *sortedDbs = [NSMutableArray array];
[sortedDbs addObjectsFromArray:[allDbs sortedArrayUsingDescriptors:[NSArray arrayWithObject:desc]]];
NSString *currentDb = nil;
@@ -1113,6 +1113,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
NSArray *allTables = [[dbs objectForKey:currentDb] allKeys];
NSSortDescriptor *desc = [[NSSortDescriptor alloc] initWithKey:nil ascending:YES selector:@selector(localizedCompare:)];
NSArray *sortedTables = [allTables sortedArrayUsingDescriptors:[NSArray arrayWithObject:desc]];
+ [desc release];
for(id table in sortedTables) {
NSDictionary * theTable = [[dbs objectForKey:currentDb] objectForKey:table];
NSInteger structtype = [[theTable objectForKey:@" struct_type "] intValue];
@@ -1164,6 +1165,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
NSArray *allFields = [theTable allKeys];
NSSortDescriptor *desc = [[NSSortDescriptor alloc] initWithKey:nil ascending:YES selector:@selector(localizedCompare:)];
NSArray *sortedFields = [allFields sortedArrayUsingDescriptors:[NSArray arrayWithObject:desc]];
+ [desc release];
for(id field in sortedFields) {
if(![field hasPrefix:@" "]) {
NSString *typ = [theTable objectForKey:field];
@@ -1191,7 +1193,6 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
}
}
}
- [desc release];
} else {
arr = [NSArray arrayWithArray:[[[[self window] delegate] valueForKeyPath:@"tableDataInstance"] valueForKey:@"columnNames"]];
if(arr == nil) {
@@ -1584,23 +1585,21 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
NSData *errdata = [stderr_file readDataToEndOfFile];
if(outdata != nil) {
- NSString *stdout = [[[NSString alloc] initWithData:outdata encoding:NSUTF8StringEncoding] description];
- NSString *error = [[[NSString alloc] initWithData:errdata encoding:NSUTF8StringEncoding] description];
+ NSString *stdout = [[NSString alloc] initWithData:outdata encoding:NSUTF8StringEncoding];
+ NSString *error = [[[NSString alloc] initWithData:errdata encoding:NSUTF8StringEncoding] autorelease];
if(bashTask) [bashTask release];
if(stdout != nil) {
if (status == 0) {
return [stdout autorelease];
} else {
- NSString *error = [[[NSString alloc] initWithData:errdata encoding:NSUTF8StringEncoding] description];
+ NSString *error = [[[NSString alloc] initWithData:errdata encoding:NSUTF8StringEncoding] autorelease];
SPBeginAlertSheet(NSLocalizedString(@"BASH Error", @"bash error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [self window], self, nil, nil, nil,
[NSString stringWithFormat:@"%@ “%@”:\n%@", NSLocalizedString(@"Error for", @"error for message"), command, [error description]]);
[stdout release];
- [error release];
NSBeep();
return @"";
}
} else {
- if(stdout) [stdout release];
NSLog(@"Couldn't read return string from “%@” by using UTF-8 encoding.", command);
NSBeep();
}