aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TablesList.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-02-10 01:32:05 +0000
committerrowanbeentje <rowan@beent.je>2010-02-10 01:32:05 +0000
commit13805614e6ed2131827bfa6c668b50a1b30da1e5 (patch)
tree8142178495af47518a2d693950d8623eec2ff2b5 /Source/TablesList.m
parentd0fb716108641d3a8c197ef12041bf46b14e7294 (diff)
downloadsequelpro-13805614e6ed2131827bfa6c668b50a1b30da1e5.tar.gz
sequelpro-13805614e6ed2131827bfa6c668b50a1b30da1e5.tar.bz2
sequelpro-13805614e6ed2131827bfa6c668b50a1b30da1e5.zip
Fix a number of memory leaks, and over-releases, as both a result of manual inspection of leaks and Clang static analysis.
Diffstat (limited to 'Source/TablesList.m')
-rw-r--r--Source/TablesList.m9
1 files changed, 5 insertions, 4 deletions
diff --git a/Source/TablesList.m b/Source/TablesList.m
index dd675c43..b66af9fb 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -2005,19 +2005,21 @@
} else {
//insert new table name in create syntax and create new table
- NSScanner *scanner = [NSScanner alloc];
+ NSScanner *scanner;
NSString *scanString;
if(tblType == SP_TABLETYPE_VIEW){
- [scanner initWithString:[[queryResult fetchRowAsDictionary] objectForKey:@"Create View"]];
+ scanner = [[NSScanner alloc] initWithString:[[queryResult fetchRowAsDictionary] objectForKey:@"Create View"]];
[scanner scanUpToString:@"AS" intoString:nil];
[scanner scanUpToString:@"" intoString:&scanString];
+ [scanner release];
[mySQLConnection queryString:[NSString stringWithFormat:@"CREATE VIEW %@ %@", [[copyTableNameField stringValue] backtickQuotedString], scanString]];
}
else if(tblType == SP_TABLETYPE_TABLE){
- [scanner initWithString:[[queryResult fetchRowAsDictionary] objectForKey:@"Create Table"]];
+ scanner = [[NSScanner alloc] initWithString:[[queryResult fetchRowAsDictionary] objectForKey:@"Create Table"]];
[scanner scanUpToString:@"(" intoString:nil];
[scanner scanUpToString:@"" intoString:&scanString];
+ [scanner release];
// If there are any InnoDB referencial constraints we need to strip out the names as they must be unique.
// MySQL will generate the new names based on the new table name.
@@ -2062,7 +2064,6 @@
}
}
- [scanner release];
if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
//error while creating new table