scratch: don't leave in use after hs_clone_scratch

Also updated unit tests to always check hs_alloc_scratch()'s return
value.
This commit is contained in:
Justin Viiret
2016-05-09 09:29:44 +10:00
committed by Matthew Barr
parent 6c1143a264
commit 73610c0b64
12 changed files with 293 additions and 151 deletions

View File

@@ -83,7 +83,8 @@ void runBlockTest(match_event_handler cb_func) {
ASSERT_EQ(1, rc.matches);
// teardown
hs_free_scratch(scratch);
err = hs_free_scratch(scratch);
ASSERT_EQ(HS_SUCCESS, err);
}
// Generic streaming mode test that uses the given scan callback.
@@ -112,7 +113,8 @@ void runStreamingTest(match_event_handler cb_func) {
// teardown
hs_close_stream(stream, scratch, nullptr, nullptr);
hs_free_scratch(scratch);
err = hs_free_scratch(scratch);
ASSERT_EQ(HS_SUCCESS, err);
}
// Generic vectored mode test that uses the given scan callback.
@@ -139,7 +141,8 @@ void runVectoredTest(match_event_handler cb_func) {
ASSERT_EQ(1, rc.matches);
// teardown
hs_free_scratch(scratch);
err = hs_free_scratch(scratch);
ASSERT_EQ(HS_SUCCESS, err);
}
static