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

Prefer calloc() to malloc() in NDK code #1320

Merged
merged 1 commit into from
Jul 15, 2021

Conversation

fractalwrench
Copy link
Contributor

Goal

Use calloc() rather than malloc() in NDK code wherever this is possible. calloc() ensures that the bytes will always be set to zero before they are read, which ensures there is no possibility of junk data being included in the bsg_event struct and leading to undefined behaviour.

Testing

Relied on existing test coverage.

@fractalwrench fractalwrench force-pushed the PLAT-7000/prefer-calloc-to-malloc branch from de75f27 to 7c5bca4 Compare July 14, 2021 13:06
@fractalwrench fractalwrench force-pushed the PLAT-7000/prefer-calloc-to-malloc branch from 7c5bca4 to de2b72c Compare July 14, 2021 14:24
@fractalwrench fractalwrench marked this pull request as ready for review July 14, 2021 14:26
@fractalwrench fractalwrench merged commit bbc1f7e into next Jul 15, 2021
@fractalwrench fractalwrench deleted the PLAT-7000/prefer-calloc-to-malloc branch July 15, 2021 09:21
@fractalwrench fractalwrench mentioned this pull request Jul 15, 2021
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