aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TablesList.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-12-14 01:23:29 +0000
committerrowanbeentje <rowan@beent.je>2009-12-14 01:23:29 +0000
commit5247ac10ff8d1fe91756c60dfd05605e8bc3d884 (patch)
tree5aa40a57a722c2b38d9759ff772530960d3d3d98 /Source/TablesList.m
parent5298595375e55bb70edae0ddf17d921a299b1014 (diff)
downloadsequelpro-5247ac10ff8d1fe91756c60dfd05605e8bc3d884.tar.gz
sequelpro-5247ac10ff8d1fe91756c60dfd05605e8bc3d884.tar.bz2
sequelpro-5247ac10ff8d1fe91756c60dfd05605e8bc3d884.zip
- Work through static analysis of the source, fixing a number of small memory leaks and fixing a couple of over-releases
Diffstat (limited to 'Source/TablesList.m')
-rw-r--r--Source/TablesList.m12
1 files changed, 3 insertions, 9 deletions
diff --git a/Source/TablesList.m b/Source/TablesList.m
index 8ca98f9a..6d60faed 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -63,11 +63,8 @@
NSArray *resultRow;
int i;
NSString *previousSelectedTable = nil;
- NSInteger selectedRowIndex;
BOOL previousTableListIsSelectable = tableListIsSelectable;
-
- selectedRowIndex = [tablesListView selectedRow];
-
+
if (selectedTableName) previousSelectedTable = [[NSString alloc] initWithString:selectedTableName];
if (isTableListFiltered) {
if (filteredTables) [filteredTables release];
@@ -2050,13 +2047,11 @@
id tableSyntax = [[theResult fetchRowAsArray] objectAtIndex:2];
if ([tableSyntax isKindOfClass:[NSData class]])
- tableSyntax = [[NSString alloc] initWithData:tableSyntax encoding:[mySQLConnection encoding]];
+ tableSyntax = [[[NSString alloc] initWithData:tableSyntax encoding:[mySQLConnection encoding]] autorelease];
// replace the old name by the new one and drop the old one
[mySQLConnection queryString:[tableSyntax stringByReplacingOccurrencesOfRegex:[NSString stringWithFormat:@"(?<=%@ )(`[^`]+?`)", [tableType uppercaseString]] withString:[[copyTableNameField stringValue] backtickQuotedString]]];
- [tableSyntax release];
-
if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
[NSString stringWithFormat:NSLocalizedString(@"Couldn't duplicate '%@'.\nMySQL said: %@", @"message of panel when an item cannot be renamed"), [copyTableNameField stringValue], [mySQLConnection getLastErrorMessage]]);
@@ -2182,7 +2177,7 @@
id tableSyntax = [[theResult fetchRowAsArray] objectAtIndex:2];
if ([tableSyntax isKindOfClass:[NSData class]])
- tableSyntax = [[NSString alloc] initWithData:tableSyntax encoding:[mySQLConnection encoding]];
+ tableSyntax = [[[NSString alloc] initWithData:tableSyntax encoding:[mySQLConnection encoding]] autorelease];
NSString *tableType;
@@ -2203,7 +2198,6 @@
// replace the old name by the new one and drop the old one
[mySQLConnection queryString:[tableSyntax stringByReplacingOccurrencesOfRegex:[NSString stringWithFormat:@"(?<=%@ )(`[^`]+?`)", [tableType uppercaseString]] withString:[[tableRenameField stringValue] backtickQuotedString]]];
- [tableSyntax release];
if ([[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
if ([mySQLConnection isConnected]) {
[mySQLConnection queryString: [NSString stringWithFormat: @"DROP %@ %@", tableType, [[self tableName] backtickQuotedString]]];