intel / intel/hyperscan

hs_serialized_database_info() custom allocator but no exposed misc free function

Open
#441 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5.5k
Forks
816
Avg merge
4d 21h
Merged PRs (30d)
2

Description

According to the documentation a custom allocator can be used but there is no way to know if a custom allocator is being used.

According to docs:

[hs_error_t](https://intel.github.io/hyperscan/dev-reference/api_files.html#c.hs_error_t) hs_serialized_database_info(const char *bytes, size_t length, char **info)
Utility function providing information about a serialized database.

Parameters
bytes – Pointer to a serialized database.

length – Length in bytes of the serialized database.

info – On success, a string containing the version and platform information for the supplied serialized database is placed in the parameter. The string is allocated using the allocator supplied in [hs_set_misc_allocator()](https://intel.github.io/hyperscan/dev-reference/api_files.html#hs__common_8h_1a28571486e60e29b54d6b5fcf9ec1e0b1) (or malloc() if no allocator was set) and should be freed by the caller.

Returns
[HS_SUCCESS](https://intel.github.io/hyperscan/dev-reference/api_files.html#group__HS__ERROR_1ga2d533509db8628a7e0eb794e2b3e77b0) on success, other values on failure.

The string is allocated using the allocator supplied in `hs_set_misc_allocator()` however `hs_misc_free` is not exposed.

Since `hs_misc_free` is not exposed you have to assume `free()` it would be far better if `hs_misc_free` was exposed to be used to free the memory.

The free free function should be exposed for any custom allocator overrides.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.