aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-08-19 22:10:52 +0000
committerstuconnolly <stuart02@gmail.com>2010-08-19 22:10:52 +0000
commitdabf6466f11e5936ee871b8b3dd573020a142586 (patch)
treeda26bda69942c69c7fbea4d0d764fcc7baeeeb33
parentfdf2f07d8dfd4260c2dd5dd3326ad7206c1e30f1 (diff)
downloadsequelpro-dabf6466f11e5936ee871b8b3dd573020a142586.tar.gz
sequelpro-dabf6466f11e5936ee871b8b3dd573020a142586.tar.bz2
sequelpro-dabf6466f11e5936ee871b8b3dd573020a142586.zip
Fix various potential memory leaks and general warnings as a result of static analysis.
-rw-r--r--Source/SPCSVExporter.m2
-rw-r--r--Source/SPDatabaseCopy.m6
-rw-r--r--Source/SPDatabaseRename.m2
-rw-r--r--Source/SPIndexesController.m1
-rw-r--r--Source/SPSQLExporter.m3
-rw-r--r--Source/SPTableCopy.m6
-rw-r--r--Source/SPUserManager.m8
7 files changed, 17 insertions, 11 deletions
diff --git a/Source/SPCSVExporter.m b/Source/SPCSVExporter.m
index cb0249ef..deae305b 100644
--- a/Source/SPCSVExporter.m
+++ b/Source/SPCSVExporter.m
@@ -182,7 +182,7 @@
if ([self csvTableName] && (![self csvDataArray])) {
- NSDictionary *tableDetails;
+ NSDictionary *tableDetails = nil;
// Determine whether the supplied table is actually a table or a view via the CREATE TABLE command, and get the table details
MCPResult *queryResult = [connection queryString:[NSString stringWithFormat:@"SHOW CREATE TABLE %@", [[self csvTableName] backtickQuotedString]]];
diff --git a/Source/SPDatabaseCopy.m b/Source/SPDatabaseCopy.m
index 8942dee1..cd7d1584 100644
--- a/Source/SPDatabaseCopy.m
+++ b/Source/SPDatabaseCopy.m
@@ -47,11 +47,11 @@
- (BOOL)copyDatabaseFrom:(NSString *)sourceDatabaseName to:(NSString *)targetDatabaseName withContent:(BOOL)copyWithContent
{
- SPDatabaseInfo *databaseInfo = [self getDBInfoObject];
+ NSArray *tables = nil;
- // Check, whether the source database exists and the target database doesn't.
- NSArray *tables = [NSArray array];
+ SPDatabaseInfo *databaseInfo = [self getDBInfoObject];
+ // Check, whether the source database exists and the target database doesn't.
BOOL sourceExists = [databaseInfo databaseExists:sourceDatabaseName];
BOOL targetExists = [databaseInfo databaseExists:targetDatabaseName];
diff --git a/Source/SPDatabaseRename.m b/Source/SPDatabaseRename.m
index b565b406..ed0374a7 100644
--- a/Source/SPDatabaseRename.m
+++ b/Source/SPDatabaseRename.m
@@ -50,7 +50,7 @@
SPDatabaseInfo *databaseInfo = [self getDBInfoObject];
// Check, whether the source database exists and the target database doesn't.
- NSArray *tables = [NSArray array];
+ NSArray *tables = nil;
BOOL sourceExists = [databaseInfo databaseExists:sourceDatabaseName];
BOOL targetExists = [databaseInfo databaseExists:targetDatabaseName];
diff --git a/Source/SPIndexesController.m b/Source/SPIndexesController.m
index baef2738..6fd94d00 100644
--- a/Source/SPIndexesController.m
+++ b/Source/SPIndexesController.m
@@ -34,7 +34,6 @@
@end
-
@implementation SPIndexesController
@synthesize table;
diff --git a/Source/SPSQLExporter.m b/Source/SPSQLExporter.m
index c53a08ea..29385644 100644
--- a/Source/SPSQLExporter.m
+++ b/Source/SPSQLExporter.m
@@ -199,6 +199,8 @@
{
// Check for cancellation flag
if ([self isCancelled]) {
+ [errors release];
+ [sqlString release];
[pool release];
return;
}
@@ -337,6 +339,7 @@
if ([self isCancelled]) {
[connection cancelCurrentQuery];
[streamingResult cancelResultLoad];
+ [streamingResult release];
[sqlExportPool release];
[pool release];
diff --git a/Source/SPTableCopy.m b/Source/SPTableCopy.m
index c965350a..be486cf2 100644
--- a/Source/SPTableCopy.m
+++ b/Source/SPTableCopy.m
@@ -53,7 +53,11 @@
[connection queryString:createTableStatement];
- if ([connection queryErrored]) return NO;
+ if ([connection queryErrored]) {
+ [createTableStatement release];
+
+ return NO;
+ }
return YES;
}
diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m
index da87a454..8bd1f687 100644
--- a/Source/SPUserManager.m
+++ b/Source/SPUserManager.m
@@ -78,11 +78,11 @@
@"Replication_slave_priv", @"Repl_slave_priv",
@"Replication_client_priv", @"Repl_client_priv",
nil];
- }
- schemas = [[NSMutableArray alloc] init];
- availablePrivs = [[NSMutableArray alloc] init];
- grantedSchemaPrivs = [[NSMutableArray alloc] init];
+ schemas = [[NSMutableArray alloc] init];
+ availablePrivs = [[NSMutableArray alloc] init];
+ grantedSchemaPrivs = [[NSMutableArray alloc] init];
+ }
return self;
}