]> git.proxmox.com Git - mirror_qemu.git/commit
RISC-V: Fix a memory leak when realizing a sifive_e
authorPalmer Dabbelt <palmer@sifive.com>
Fri, 14 Jun 2019 11:58:41 +0000 (04:58 -0700)
committerPalmer Dabbelt <palmer@sifive.com>
Mon, 24 Jun 2019 06:44:42 +0000 (23:44 -0700)
commitc988de4119af0a0ae7983e870babb5f15793590e
tree798a2ff0b9b51042703e274e0b1c0045ab51004d
parent5b7ae1cec9af5bf96fdc963a52a4595c51b128f9
RISC-V: Fix a memory leak when realizing a sifive_e

Coverity pointed out a memory leak in riscv_sifive_e_soc_realize(),
where a pair of recently added MemoryRegion instances would not be freed
if there were errors elsewhere in the function.  The fix here is to
simply not use dynamic allocation for these instances: there's always
one of each in SiFiveESoCState, so instead we just include them within
the struct.

Fixes: 30efbf330a45 ("SiFive RISC-V GPIO Device")
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
hw/riscv/sifive_e.c
include/hw/riscv/sifive_e.h