From da87ee2564f73d7f578ffb08e5d03073ce49d694 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Sat, 13 Mar 2010 20:41:36 +0000 Subject: - Fix some leaks and autoreleases after checking static analysis --- Source/TableSource.m | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'Source/TableSource.m') diff --git a/Source/TableSource.m b/Source/TableSource.m index e6d2d170..4694d14c 100644 --- a/Source/TableSource.m +++ b/Source/TableSource.m @@ -1128,6 +1128,7 @@ returns a dictionary containing enum/set field names as key and possible values NSMutableArray *tempResult2 = [NSMutableArray array]; NSString *nullValue = [prefs stringForKey:SPNullValue]; + CFStringRef escapedNullValue = CFXMLCreateStringByEscapingEntities(NULL, ((CFStringRef)nullValue), NULL); MCPResult *structureQueryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW COLUMNS FROM %@", [selectedTable backtickQuotedString]]]; MCPResult *indexesQueryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW INDEXES FROM %@", [selectedTable backtickQuotedString]]]; @@ -1156,9 +1157,7 @@ returns a dictionary containing enum/set field names as key and possible values for (j = 0; j < [row count]; j++) { if ([[row objectAtIndex:j] isNSNull]) { - - // Replace the NULL instance with an escaped version of the user's placeholder - [row replaceObjectAtIndex:j withObject:(NSString *)CFXMLCreateStringByEscapingEntities(NULL, ((CFStringRef)nullValue), NULL)]; + [row replaceObjectAtIndex:j withObject:(NSString *)escapedNullValue]; } } @@ -1166,7 +1165,7 @@ returns a dictionary containing enum/set field names as key and possible values [row release]; } - + for (i = 0; i < [indexesQueryResult numOfRows]; i++) { NSMutableArray *index = [[indexesQueryResult fetchRowAsArray] mutableCopy]; @@ -1177,9 +1176,7 @@ returns a dictionary containing enum/set field names as key and possible values for (j = 0; j < [index count]; j++) { if ([[index objectAtIndex:j] isNSNull]) { - - // Replace the NULL instance with an escaped version of the user's placeholder - [index replaceObjectAtIndex:j withObject:(NSString *)CFXMLCreateStringByEscapingEntities(NULL, ((CFStringRef)nullValue), NULL)]; + [index replaceObjectAtIndex:j withObject:(NSString *)escapedNullValue]; } } @@ -1187,7 +1184,8 @@ returns a dictionary containing enum/set field names as key and possible values [index release]; } - + + CFRelease(escapedNullValue); return [NSDictionary dictionaryWithObjectsAndKeys:tempResult, @"structure", tempResult2, @"indexes", nil]; } -- cgit v1.2.3