hs_serialize_database() uses the standard C allocator, so the returned
buffer must be freed with free(), not g_free(). Mixing allocators
causes memory corruption when hiredis is configured to use glib.
hs_platform_info_t plt;
err = hs_populate_platform(&plt);
if (err != HS_SUCCESS) {
- g_free(ser_bytes);
+ free(ser_bytes);
lua_pushnil(L);
lua_pushstring(L, "failed to get platform info");
return 2;
/* Copy serialized database */
memcpy(p, ser_bytes, ser_size);
- /* Free hyperscan-allocated buffer */
- g_free(ser_bytes);
+ /* Free hyperscan-allocated buffer (use free(), not g_free()) */
+ free(ser_bytes);
return 1;
}