diff options
author | stuconnolly <stuart02@gmail.com> | 2012-05-02 19:36:58 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2012-05-02 19:36:58 +0000 |
commit | 74843eab993bd3aac144f2d6ce5e69f76b002bd2 (patch) | |
tree | 979491b96551c262321a530d9d16ab3400a7dfb9 | |
parent | f04710798a01782fddd4f7e848d8a534dedb2e7e (diff) | |
download | sequelpro-74843eab993bd3aac144f2d6ce5e69f76b002bd2.tar.gz sequelpro-74843eab993bd3aac144f2d6ce5e69f76b002bd2.tar.bz2 sequelpro-74843eab993bd3aac144f2d6ce5e69f76b002bd2.zip |
Fix memory leaks.
-rw-r--r-- | Source/SPConnectionController.m | 6 | ||||
-rw-r--r-- | Source/SPFavoriteNode.m | 2 | ||||
-rw-r--r-- | Source/SPFavoritesController.m | 12 | ||||
-rw-r--r-- | Source/SPFavoritesImporter.m | 2 | ||||
-rw-r--r-- | Source/SPIndexesController.m | 6 | ||||
-rw-r--r-- | Source/SPPreferencesUpgrade.m | 2 | ||||
-rw-r--r-- | Source/SPUserManager.m | 4 |
7 files changed, 24 insertions, 10 deletions
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index 58eb4002..a2b3c06c 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -1127,7 +1127,10 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, NSMutableArray *nodes = [[node mutableChildNodes] mutableCopy]; // If this node only has one child and it's not another group node, don't bother proceeding - if (([nodes count] == 1) && (![[nodes objectAtIndex:0] isGroup])) return; + if (([nodes count] == 1) && (![[nodes objectAtIndex:0] isGroup])) { + [nodes release]; + return; + } for (SPTreeNode *treeNode in nodes) { @@ -1166,6 +1169,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, [[node mutableChildNodes] setArray:nodes]; + [nodes release]; [groupNodes release]; } diff --git a/Source/SPFavoriteNode.m b/Source/SPFavoriteNode.m index 2d124756..cdd35925 100644 --- a/Source/SPFavoriteNode.m +++ b/Source/SPFavoriteNode.m @@ -68,7 +68,7 @@ static NSString *SPFavoriteNodeKey = @"SPFavoriteNode"; [node setNodeFavorite:[[self nodeFavorite] copyWithZone:zone]]; - return node; + return [node autorelease]; } #pragma mark - diff --git a/Source/SPFavoritesController.m b/Source/SPFavoritesController.m index c53bbae3..45eb5c9a 100644 --- a/Source/SPFavoritesController.m +++ b/Source/SPFavoritesController.m @@ -273,8 +273,6 @@ static SPFavoritesController *sharedFavoritesController = nil; SPTreeNode *node = [self _constructBranchForNodeData:favorite]; [[favoritesNode mutableChildNodes] addObject:node]; - - [node release]; } [[rootNode mutableChildNodes] addObject:favoritesNode]; @@ -307,24 +305,26 @@ static SPFavoritesController *sharedFavoritesController = nil; treeNode = [[SPTreeNode alloc] initWithRepresentedObject:node]; + [node release]; + [treeNode setIsGroup:YES]; for (NSDictionary *favorite in [nodeData objectForKey:SPFavoriteChildrenKey]) { SPTreeNode *innerNode = [self _constructBranchForNodeData:favorite]; - [[treeNode mutableChildNodes] addObject:innerNode]; - - [innerNode release]; + [[treeNode mutableChildNodes] addObject:innerNode]; } } else { node = [[SPFavoriteNode alloc] initWithDictionary:nodeData]; treeNode = [[SPTreeNode alloc] initWithRepresentedObject:node]; + + [node release]; } - return treeNode; + return [treeNode autorelease]; } /** diff --git a/Source/SPFavoritesImporter.m b/Source/SPFavoritesImporter.m index 5ec0c433..b01fb356 100644 --- a/Source/SPFavoritesImporter.m +++ b/Source/SPFavoritesImporter.m @@ -69,6 +69,8 @@ NSArray *favorites = [importData valueForKey:SPFavoritesDataRootKey]; + [importData release]; + if (favorites) { [self _informDelegateOfImportDataAvailable:favorites]; } diff --git a/Source/SPIndexesController.m b/Source/SPIndexesController.m index 9db491ae..840ef33f 100644 --- a/Source/SPIndexesController.m +++ b/Source/SPIndexesController.m @@ -520,7 +520,11 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; [availableFields removeObjectsInArray:indexedFields]; - return [[availableFields objectAtIndex:index] objectForKey:@"name"]; + NSString *name = [[availableFields objectAtIndex:index] objectForKey:@"name"]; + + [availableFields release]; + + return name; } #pragma mark - diff --git a/Source/SPPreferencesUpgrade.m b/Source/SPPreferencesUpgrade.m index 10a86a5d..5eb7409f 100644 --- a/Source/SPPreferencesUpgrade.m +++ b/Source/SPPreferencesUpgrade.m @@ -337,6 +337,7 @@ void SPMigrateConnectionFavoritesData(void) if (error) { NSLog(@"Error loading favorites: %@", [error localizedDescription]); + [favorites release]; return; } @@ -367,6 +368,7 @@ void SPMigrateConnectionFavoritesData(void) else if (errorString) { NSLog(@"Error converting migrating favorites data to plist format: %@", errorString); + [favorites release]; [errorString release]; return; } diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m index a56bfc96..ad6ac390 100644 --- a/Source/SPUserManager.m +++ b/Source/SPUserManager.m @@ -1370,7 +1370,9 @@ static const NSString *SPTableViewNameColumnID = @"NameColumn"; } } - [connection queryString:renameQuery]; + if (renameQuery) { + [connection queryString:renameQuery]; + } } #pragma mark - |