From 8bfbf07f75411924626910970de89405ce2a9605 Mon Sep 17 00:00:00 2001 From: "Chang, Harry" Date: Thu, 20 Jun 2019 08:59:18 +0800 Subject: [PATCH] Do not free stream unless hs_close_stream returns success. (by unit-hyperscan HyperscanArgChecks.CloseStreamNoScratch) --- src/runtime.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/runtime.c b/src/runtime.c index 078c8821..ed1eaf53 100644 --- a/src/runtime.c +++ b/src/runtime.c @@ -1006,17 +1006,14 @@ hs_error_t HS_CDECL hs_close_stream(hs_stream_t *id, hs_scratch_t *scratch, if (onEvent) { if (!scratch || !validScratch(id->rose, scratch)) { - hs_stream_free(id); return HS_INVALID; } if (unlikely(markScratchInUse(scratch))) { - hs_stream_free(id); return HS_SCRATCH_IN_USE; } report_eod_matches(id, scratch, onEvent, context); if (unlikely(internal_matching_error(scratch))) { unmarkScratchInUse(scratch); - hs_stream_free(id); return HS_UNKNOWN_ERROR; } unmarkScratchInUse(scratch);