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 leak in owned_to_vec #773

Merged
merged 4 commits into from
Mar 5, 2025
Merged

Conversation

venomousmoog
Copy link
Contributor

The following sequence:

    let b1 = Bytes::from_owner(owner);
    let v1: Vec<u8> = b1.into();

Would fail to drop owner (the expectation for the vtable *_to_vec is that it takes ownership of the instance, but owned_to_vec was not). Since owned_to_mut depended on owned_to_vec and was correctly dropping, the fix was to move the drop logic from owned_to_mut to owned_to_vec.

This change adds an appropriate test for ::into() for Bytes::from_owner.

Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.

@Darksonn Darksonn merged commit 3667543 into tokio-rs:master Mar 5, 2025
18 checks passed
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.

2 participants