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);