]> git.proxmox.com Git - mirror_qemu.git/commit
target/arm: Create timers in realize, not init
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 14 Dec 2018 13:30:55 +0000 (13:30 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 14 Dec 2018 13:30:55 +0000 (13:30 +0000)
commit397cd31f01228c42d32261a6db3ead140cac8a7c
tree61a065de78882855b498569b0855bdc5536cfbbe
parent0012eb98f165e98ede33b5b57fb1985f1fe224b7
target/arm: Create timers in realize, not init

The timer_new() function allocates memory; this means that
if we call it in the CPU's init method we would need
to provide an instance_finalize method to free it. Defer
the timer creation to the realize function instead.

This fixes a memory leak spotted by clang LeakSanitizer
when a CPU object is created for introspection.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181204132952.2601-6-peter.maydell@linaro.org
target/arm/cpu.c