stream close: free stream to avoid memory leak

fix github issue #303
This commit is contained in:
Hong, Yang A 2022-10-19 16:50:02 +00:00 committed by Konstantinos Margaritis
parent 941cc7144b
commit 659525480c

View File

@ -1013,6 +1013,7 @@ hs_error_t HS_CDECL hs_close_stream(hs_stream_t *id, hs_scratch_t *scratch,
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);