aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-07-06 22:29:50 +0000
committerstuconnolly <stuart02@gmail.com>2010-07-06 22:29:50 +0000
commit98321e0139af73928307da87ed31245b858e86d0 (patch)
tree1ca248b1785660e63eab1a0f17a917562752e291 /Source
parent2831094df859915cc3af9bc275bd35753aff8192 (diff)
downloadsequelpro-98321e0139af73928307da87ed31245b858e86d0.tar.gz
sequelpro-98321e0139af73928307da87ed31245b858e86d0.tar.bz2
sequelpro-98321e0139af73928307da87ed31245b858e86d0.zip
Fix various memory leaks as a result of static analysis.
Diffstat (limited to 'Source')
-rw-r--r--Source/SPCSVExporter.m4
-rw-r--r--Source/SPDatabaseCopy.m3
-rw-r--r--Source/SPDotExporter.m1
-rw-r--r--Source/SPSQLExporter.m6
-rw-r--r--Source/SPTableCopy.m7
5 files changed, 13 insertions, 8 deletions
diff --git a/Source/SPCSVExporter.m b/Source/SPCSVExporter.m
index 49d6ade6..40feadf9 100644
--- a/Source/SPCSVExporter.m
+++ b/Source/SPCSVExporter.m
@@ -186,9 +186,9 @@
[queryResult setReturnDataAsStrings:YES];
if ([queryResult numOfRows]) {
- tableDetails = [[NSDictionary alloc] initWithDictionary:[queryResult fetchRowAsDictionary]];
+ id object = [[[NSDictionary alloc] initWithDictionary:[queryResult fetchRowAsDictionary]] objectForKey:@"Create View"];
- tableDetails = [[NSDictionary alloc] initWithDictionary:([tableDetails objectForKey:@"Create View"]) ? [[self csvTableData] informationForView:[self csvTableName]] : [[self csvTableData] informationForTable:[self csvTableName]]];
+ tableDetails = [[NSDictionary alloc] initWithDictionary:(object) ? [[self csvTableData] informationForView:[self csvTableName]] : [[self csvTableData] informationForTable:[self csvTableName]]];
}
// Retrieve the table details via the data class, and use it to build an array containing column numeric status
diff --git a/Source/SPDatabaseCopy.m b/Source/SPDatabaseCopy.m
index 04b801b3..913554c2 100644
--- a/Source/SPDatabaseCopy.m
+++ b/Source/SPDatabaseCopy.m
@@ -76,6 +76,9 @@
success = NO;
}
}
+
+ [dbActionTableCopy release];
+
return success;
}
diff --git a/Source/SPDotExporter.m b/Source/SPDotExporter.m
index 044065e5..9296b231 100644
--- a/Source/SPDotExporter.m
+++ b/Source/SPDotExporter.m
@@ -106,6 +106,7 @@
{
// Check for cancellation flag
if ([self isCancelled]) {
+ [fkInfo release];
[pool release];
return;
}
diff --git a/Source/SPSQLExporter.m b/Source/SPSQLExporter.m
index 07b6a0e0..d7a82666 100644
--- a/Source/SPSQLExporter.m
+++ b/Source/SPSQLExporter.m
@@ -84,8 +84,6 @@
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
sqlTableDataInstance = [[[SPTableData alloc] init] autorelease];
[sqlTableDataInstance setConnection:connection];
-
- NSAutoreleasePool *sqlExportPool = [[NSAutoreleasePool alloc] init];
MCPResult *queryResult;
MCPStreamingResult *streamingResult;
@@ -120,6 +118,8 @@
(![self sqlDatabaseName]) || ([[self sqlDatabaseName] isEqualToString:@""]) ||
(![self sqlDatabaseVersion] || ([[self sqlDatabaseName] isEqualToString:@""])))
{
+ [errors release];
+ [sqlString release];
[pool release];
return;
}
@@ -321,7 +321,7 @@
// Iterate through the rows to construct a VALUES group for each
j = 0, k = 0;
- sqlExportPool = [[NSAutoreleasePool alloc] init];
+ NSAutoreleasePool *sqlExportPool = [[NSAutoreleasePool alloc] init];
// Inform the delegate that we are about to start writing the data to disk
[delegate performSelectorOnMainThread:@selector(sqlExportProcessWillBeginWritingData:) withObject:self waitUntilDone:NO];
diff --git a/Source/SPTableCopy.m b/Source/SPTableCopy.m
index 5af46972..bb819371 100644
--- a/Source/SPTableCopy.m
+++ b/Source/SPTableCopy.m
@@ -57,9 +57,7 @@
[createTableStatement insertString:@"." atIndex:13];
[createTableStatement insertString:[targetDB backtickQuotedString] atIndex:13];
- [connection queryString:createTableStatement];
- [createTableStatement release];
-
+ [connection queryString:createTableStatement];
if ([connection queryErrored]) {
SPBeginAlertSheet(NSLocalizedString(@"Failed to copy table", @"copy table error message"),
@@ -73,6 +71,9 @@
} else {
NSLog(@"Could not copy non-table/view %@", tableName);
}
+
+ [createTableStatement release];
+
return NO;
}