diff --git a/osquery/core/test_util_tests.cpp b/osquery/core/test_util_tests.cpp index af5da5e3..fca4a38d 100644 --- a/osquery/core/test_util_tests.cpp +++ b/osquery/core/test_util_tests.cpp @@ -13,7 +13,9 @@ class TestUtilTests : public testing::Test {}; TEST_F(TestUtilTests, test_expected_results) { int err; - auto results = aggregateQuery(kTestQuery, err, createTestDB()); + auto db = createTestDB(); + auto results = aggregateQuery(kTestQuery, err, db); + sqlite3_close(db); EXPECT_EQ(err, 0); EXPECT_EQ(results, getTestDBExpectedResults()); } @@ -31,6 +33,7 @@ TEST_F(TestUtilTests, test_get_test_db_result_stream) { } int err_int; auto expected = aggregateQuery(kTestQuery, err_int, db); + sqlite3_close(db); EXPECT_EQ(expected, r.second); } }