Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
There's a subtle lifetime issue created in the original code. The original code uses: - `Bytes::from(&'static [u8])` - `from_raw_parts<'a, T>(*const T, usize) -> &'a [T]` Which requires the `*const T` pointer be a static pointer. Being provided through the FFI, this is unreasonable, and we should expect it to last only as long as the function call itself. By simply replacing `Bytes::from` with `Bytes::from_from_slice`, we narrow down the lifetime from `'static` to `'a`, allowing for the underlying `*const T` pointer to be deallocated once the function has returned. Signed-off-by: JP-Ellis <josh@jpellis.me>
- Loading branch information