mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
Scratch: fix scratch free issue when memory allocation fails
Fixes github issue #174
This commit is contained in:
parent
177537313a
commit
49592833a7
@ -279,7 +279,9 @@ hs_error_t HS_CDECL hs_alloc_scratch(const hs_database_t *db,
|
|||||||
hs_error_t proto_ret = hs_check_alloc(proto_tmp);
|
hs_error_t proto_ret = hs_check_alloc(proto_tmp);
|
||||||
if (proto_ret != HS_SUCCESS) {
|
if (proto_ret != HS_SUCCESS) {
|
||||||
hs_scratch_free(proto_tmp);
|
hs_scratch_free(proto_tmp);
|
||||||
hs_scratch_free(*scratch);
|
if (*scratch) {
|
||||||
|
hs_scratch_free((*scratch)->scratch_alloc);
|
||||||
|
}
|
||||||
*scratch = NULL;
|
*scratch = NULL;
|
||||||
return proto_ret;
|
return proto_ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user