brave / adblock-rust-ffi

An FFI crate to expose functionality from brave/adblock-rust
Mozilla Public License 2.0
47 stars 16 forks source link

Free memory correctly #13

Closed antonok-edm closed 4 years ago

antonok-edm commented 4 years ago

As per https://doc.rust-lang.org/std/ffi/struct.CString.html#method.into_raw, free should not be called on strings passed across the FFI. They should be passed back and reconstructed into CStrings so that Rust can deallocate them properly.

My fault for not noticing that you'd already added c_char_buffer_destroy for this purpose!