hnsd
hnsd copied to clipboard
ci: build with sanitizer to check for memory issues
Built off https://github.com/handshake-org/hnsd/pull/99 which fixes some memory leaks.
This PR adds a flag configure --with-sanitizers=<sanitizers> where <sanitizers> is a comma separated list of sanitizers like address,leak. I borrowed the configure logic from Bitcoin Core: https://github.com/bitcoin/bitcoin/blob/38d06e1561013f4ca845fd5ba6ffcc64de67f9c0/configure.ac#L315-L319
The 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