OSDN Git Service

riscv: spike: Fix memory leak in the board init
authorAlistair Francis <Alistair.Francis@wdc.com>
Mon, 5 Nov 2018 19:44:41 +0000 (19:44 +0000)
committerPalmer Dabbelt <palmer@sifive.com>
Thu, 8 Nov 2018 16:41:06 +0000 (08:41 -0800)
commit00a014ac01feac875468d38c376f7e06f050f992
treeae6d523b18ab3e60213af4bbf17c5e6729440c77
parenta7ce790a029bd94eb320d8c69f38900f5233997e
riscv: spike: Fix memory leak in the board init

Coverity caught a malloc() call that was never freed. This patch ensures
that we free the memory but also updates the allocation to use
g_strdup_printf() instead of malloc().

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Palmer Dabbelt <palmer@sifive.com>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
hw/riscv/spike.c