mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
Do not free stream unless hs_close_stream returns success.
(by unit-hyperscan HyperscanArgChecks.CloseStreamNoScratch)
This commit is contained in:
parent
4b1927c038
commit
8bfbf07f75
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user