Skip to content

arm: five simple memory leak fixes

Peter Maydell qemu-arm qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 9 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5target/arm: Free name string in ARMCPRegInfo hashtable entriestarget/arm/cpu.c+15 -12 replies
2/5hw/arm/mps2-tz.c: Free mscname string in make_dma()hw/arm/mps2-tz.c+1 -02 replies
3/5hw/sd/sdhci: Don't leak memory region in sdhci_sysbus_realize()hw/sd/sdhci.c+1 -42 replies
4/5tests/test-arm-mptimer: Don't leak string memorytests/test-arm-mptimer.c+69 -842 replies
5/5target/arm: Create timers in realize, not inittarget/arm/cpu.c+9 -81 reply

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchRichard HendersonPhilippe Mathieu-Daudé
1/5R-b R-b
2/5R-b R-b
3/5R-b R-b
4/5R-b R-b
5/5R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [Qemu-arm] [PATCH 0/5] arm: five simple memory leak fixes

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(-)
Signature · 1 line
2.19.2