aboutsummaryrefslogtreecommitdiff
path: root/Foundation/GTMSQLiteTest.m
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2010-02-01 23:33:54 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2010-02-01 23:33:54 +0000
commit8352c13af31be429bd5fd5c36d169fe0ff4c354e (patch)
tree2544d4a542071b1847ab1412849a1417b3f9fe8d /Foundation/GTMSQLiteTest.m
parente11d9defc1af0936ec49d88b0681ac603a52a4f5 (diff)
[Author: dmaclach]
Fix up a sqllite test leak R=thomasvl DELTA=4 (3 added, 0 deleted, 1 changed)
Diffstat (limited to 'Foundation/GTMSQLiteTest.m')
-rw-r--r--Foundation/GTMSQLiteTest.m12
1 files changed, 11 insertions, 1 deletions
diff --git a/Foundation/GTMSQLiteTest.m b/Foundation/GTMSQLiteTest.m
index 5d683c0..50e893e 100644
--- a/Foundation/GTMSQLiteTest.m
+++ b/Foundation/GTMSQLiteTest.m
@@ -1758,15 +1758,18 @@ static NSArray* LikeGlobTestHelper(GTMSQLiteDatabase *db, NSString *sql) {
STAssertNotNil(db, @"Failed to create database");
+ sqlite3 *sqlite3DB = [db sqlite3DB];
+
NSString *selectSQL = @"select 1";
GTMSQLiteStatement *statement;
statement = [GTMSQLiteStatement statementWithSQL:selectSQL
inDatabase:db
errorCode:&err];
-
STAssertNotNil(statement, @"Failed to create select statement");
STAssertEquals(err, SQLITE_OK, @"Failed to create select statement");
+ sqlite3_stmt *sqlite3Statment = [statement sqlite3Statement];
+
err = [statement stepRow];
STAssertEquals(err, SQLITE_ROW,
@"failed to step row for finalize test");
@@ -1778,6 +1781,13 @@ static NSArray* LikeGlobTestHelper(GTMSQLiteDatabase *db, NSString *sql) {
[GTMUnitTestDevLog expectString:expectedLog];
[GTMUnitTestDevLog expectPattern:@"Unable to close .*"];
[localPool drain];
+
+ // Clean up leaks. Since we hadn't finalized the statement above we
+ // were unable to clean up the sqlite databases. Since the pool is drained
+ // all of our objective-c objects are gone, so we have to call the
+ // sqlite3 api directly.
+ STAssertEquals(sqlite3_finalize(sqlite3Statment), SQLITE_OK, nil);
+ STAssertEquals(sqlite3_close(sqlite3DB), SQLITE_OK, nil);
}
}