Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory management #227

Merged
merged 3 commits into from
Nov 17, 2023
Merged

Memory management #227

merged 3 commits into from
Nov 17, 2023

Conversation

drobnyjt
Copy link
Collaborator

Thank you for your contribution to rustBCA!

Before submitting this PR, please make sure you have:

  • Opened an issue
  • Referenced the relevant issue number(s) below
  • Provided a description of the changes below
  • 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.

@drobnyjt drobnyjt merged commit 0b5ff72 into dev Nov 17, 2023
1 check passed
@drobnyjt drobnyjt deleted the memory_management branch February 13, 2024 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant