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

Fix bugs in BytesMut::reserve_inner #544

Merged
merged 3 commits into from Apr 28, 2022

Conversation

NobodyXu
Copy link
Contributor

@NobodyXu NobodyXu commented Apr 26, 2022

Fixed bugs introduced in #529 , BytesMut::reserve_inner:

  • Fix calculation of offset

Signed-off-by: Jiahao XU Jiahao_XU@outlook.com

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
@Darksonn
Copy link
Contributor

Would you be able to add a test case for this?

@NobodyXu
Copy link
Contributor Author

NobodyXu commented Apr 28, 2022

Would you be able to add a test case for this?

Sure.

I should be able to using split_off

@NobodyXu NobodyXu changed the title Fix calculation of offset in BytesMut::reserve_inner Fix bugs in BytesMut::reserve_inner Apr 28, 2022
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
@NobodyXu
Copy link
Contributor Author

The miri failed with leaking in the newly added test, however I cannot locate the problem.

@Darksonn
Copy link
Contributor

You're using mem::forget. It's not surprising that this would result in a leak. Perhaps you meant to use drop?

@NobodyXu
Copy link
Contributor Author

You're using mem::forget. It's not surprising that this would result in a leak. Perhaps you meant to use drop?

Oh right, thank you for reminding me that!

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
@Darksonn
Copy link
Contributor

I have verified that the test fails without your change.

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.

Thanks!

I will merge this once CI passes.

@Darksonn Darksonn merged commit 0a2c43a into tokio-rs:master Apr 28, 2022
@NobodyXu NobodyXu deleted the fix/reserve_inner branch April 28, 2022 09:37
lelongg pushed a commit to lelongg/bytes that referenced this pull request Jan 9, 2023
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.

None yet

2 participants