Add memory leak tracing infrastructure and fix a memory leak.
Do this by instrumenting the malloc()/free() routines used by the
tests and have it record a stack trace for every allocation. Check at
the end of each unit test that all memory has been freed. If not,
print a list of all these stack traces.
Re-organize all tests so they derive from BaseAvbtoolTest and make
this super class do the requisite leak-reset and leak-check in Setup()
and Teardown() methods.
After doing this, the only leak identified in libavb (woot!) turned
out to be in avb_slot_verify(). Fix this. Also fix some tests that
knowingly leak memory.
Bug: None
Test: All unit tests pass.
Change-Id: I54da00ef0cc840e390cad118888affe5a86b76e3
6 files changed