I ran 'make check' with the clang sanitizers enabled, which it turns out these days includes LeakSanitizer. That points out a fair number of memory leaks, most of which are not terribly significant. This patchset fixes five of them (there are plenty more to do).
The "device does timer_new() in its instance_init function" leak seems to be a common one with multiple other devices showing up as having the same problem. Switching timer_init() is probably a nicer fix than just moving timer_new() to realize, but I wasn't sure if going from VMSTATE_TIMER_PTR to VMSTATE_TIMER would be a migration compat break. thanks -- PMM Peter Maydell (5): target/arm: Free name string in ARMCPRegInfo hashtable entries hw/arm/mps2-tz.c: Free mscname string in make_dma() hw/sd/sdhci: Don't leak memory region in sdhci_sysbus_realize() tests/test-arm-mptimer: Don't leak string memory target/arm: Create timers in realize, not init hw/arm/mps2-tz.c | 1 + hw/sd/sdhci.c | 5 +- target/arm/cpu.c | 33 ++++++--- tests/test-arm-mptimer.c | 153 ++++++++++++++++++--------------------- 4 files changed, 95 insertions(+), 97 deletions(-) -- 2.19.2