ci: build with sanitizer to check for memory issues #109
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #104
Built off #99 which fixes some memory leaks.
This PR adds a flag
configure --with-sanitizers=<sanitizers>
where<sanitizers>
is a comma separated list of sanitizers likeaddress,leak
. I borrowed the configure logic from Bitcoin Core: https://github.com/bitcoin/bitcoin/blob/38d06e1561013f4ca845fd5ba6ffcc64de67f9c0/configure.ac#L315-L319The flag is added to CI integration tests. I intentionally committed a few memory violations and then patched them to demonstrate to reviewers how this will look (it's a bit of a mess, but works by throwing errors in the bmocha suite).
example memory leak detected: https://github.com/handshake-org/hnsd/actions/runs/3527082949/jobs/5915748956#step:8:645
example use-after-free detected: https://github.com/handshake-org/hnsd/actions/runs/3527133001/jobs/5915851526#step:8:34