I'm using a C++ library from Go via SWIG. SWIG does not take care of memory management, so the Go side looks something like this:
f := NewFoo()
defer DeleteFoo(f)
It's easy enough to call DeleteFoo(f)
when I created f
, but it's easy to omit it for return values from C++ functions.
I want to automatically check that my code does the right thing.
I see Address Sanitizer is implemented for GCC and Clang and it sounds like the right thing. But I can't find a clear recipe for how I would enable it for my go test
command.