Before submitting this PR, please make sure you have:
[X] Opened an issue
[X] Referenced the relevant issue number(s) below
[X] Provided a description of the changes below
[X] Ensured all tests pass and added any necessary tests for new code
Fixes #226
Description
It turns out that even if Rust forgets a raw pointer, it cannot be safely freed once C takes ownership. This PR adds a couple of cleanup functions that correctly dispose of structs with raw pointers when coupling to C to prevent memory leaking.
Tests
cargo test passes and RustBCA.c was used with valgrind to show that this fixes the leak. See the linked issue above.
Thank you for your contribution to rustBCA!
Before submitting this PR, please make sure you have:
Fixes #226
Description
It turns out that even if Rust forgets a raw pointer, it cannot be safely freed once C takes ownership. This PR adds a couple of cleanup functions that correctly dispose of structs with raw pointers when coupling to C to prevent memory leaking.
Tests
cargo test passes and RustBCA.c was used with valgrind to show that this fixes the leak. See the linked issue above.