diff options
author | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-25 20:04:33 +0000 |
---|---|---|
committer | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-25 20:04:33 +0000 |
commit | c9b47244b8207ec691c702d673346ead6346c3be (patch) | |
tree | c7b8c583230df2eb1557aa00cecf7c1e1153ef56 /chrome | |
parent | 19229ff42262516c58625070cb9b19688334ec30 (diff) | |
download | chromium_src-c9b47244b8207ec691c702d673346ead6346c3be.zip chromium_src-c9b47244b8207ec691c702d673346ead6346c3be.tar.gz chromium_src-c9b47244b8207ec691c702d673346ead6346c3be.tar.bz2 |
Fix a leak in HistoryProfileTest.TypicalProfileVersion.
sqlite3_close returns SQLITE_BUSY if there are any outstanding statements. Since the SQLStatement object hadn't been destroyed, finalize hadn't been called, so the close failed and a lot of sqlite stuff leaked.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1321 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/history/history_unittest.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/chrome/browser/history/history_unittest.cc b/chrome/browser/history/history_unittest.cc index a8708cd..e589f11 100644 --- a/chrome/browser/history/history_unittest.cc +++ b/chrome/browser/history/history_unittest.cc @@ -723,15 +723,16 @@ TEST(HistoryProfileTest, TypicalProfileVersion) { sqlite3* db; ASSERT_EQ(SQLITE_OK, sqlite3_open(WideToUTF8(file).c_str(), &db)); - SQLStatement s; - ASSERT_EQ(SQLITE_OK, s.prepare(db, - "SELECT value FROM meta WHERE key = 'version'")); - EXPECT_EQ(SQLITE_ROW, s.step()); - int file_version = s.column_int(0); - - sqlite3_close(db); + { + SQLStatement s; + ASSERT_EQ(SQLITE_OK, s.prepare(db, + "SELECT value FROM meta WHERE key = 'version'")); + EXPECT_EQ(SQLITE_ROW, s.step()); + int file_version = s.column_int(0); + EXPECT_EQ(cur_version, file_version); + } - EXPECT_EQ(cur_version, file_version); + ASSERT_EQ(SQLITE_OK, sqlite3_close(db)); } namespace { |