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 Wire memory leak #2442

Merged
merged 1 commit into from
Jul 16, 2024
Merged

Conversation

benmalenfant
Copy link
Contributor

@benmalenfant benmalenfant commented Jul 16, 2024

Summary

This PR fixes the memory leak bug caused by multiple Wire.begin() calls, mentioned in #2441

The strategy used here is to initialise the buffer variables on the Wire object initialisation instead of the begin.

Validation

Code formatting

  • Ensure AStyle check is passed thanks CI

Closing issues

Fixes #2441

Signed-off-by: Benoit Malenfant <25072667+benmalenfant@users.noreply.github.com>
@benmalenfant benmalenfant marked this pull request as ready for review July 16, 2024 01:46
Copy link
Member

@fpistm fpistm left a comment

Choose a reason for hiding this comment

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

LGTM
Moreover it makes sense to not init pointer and size at begin() as the reset*Buffer are called after and do nothing if the pointer is null which was the case before this PR.

@fpistm fpistm added the enhancement New feature or request label Jul 16, 2024
@fpistm fpistm added this to In progress in STM32 core based on ST HAL via automation Jul 16, 2024
@fpistm fpistm added this to the 2.8.1 milestone Jul 16, 2024
@fpistm fpistm merged commit bd7f61a into stm32duino:main Jul 16, 2024
23 checks passed
STM32 core based on ST HAL automation moved this from In progress to Done Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

Wire memory leak on multiple begin() call
2 participants