diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2018-11-08 18:37:29 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2018-11-08 18:37:29 +0000 |
commit | d3c2bbb166f8cd840a3f4efec31d55485f1360ed (patch) | |
tree | ae6d523b18ab3e60213af4bbf17c5e6729440c77 | |
parent | a7ce790a029bd94eb320d8c69f38900f5233997e (diff) | |
parent | 00a014ac01feac875468d38c376f7e06f050f992 (diff) |
Merge remote-tracking branch 'remotes/riscv/tags/riscv-for-master-3.1-rc1' into staging
A Single RISC-V Patch for 3.1-rc1
This tag contains a single patch that I'd like to target for rc1: a fix
for a memory leak that was detected by static code analysis.
There are still three patch sets that I'd like to try to get up for 3.1:
* The patch set Basian just published that contains fixes for a pair of
issues he found when converting our port to decodetree.
* An as-of-yet-unwritten fix to the third issue that Basian pointed out.
* A fix to our fflags bug, which is currently coupled to some CSR
refactoring that I don't think is OK for 3.1.
I'm at Plumbers next week (and I think Alistair is there too?), but I'll
try to find a way to squeeze in as much as possible.
# gpg: Signature made Thu 08 Nov 2018 16:50:27 GMT
# gpg: using RSA key EF4CA1502CCBAB41
# gpg: Good signature from "Palmer Dabbelt <palmer@dabbelt.com>"
# gpg: aka "Palmer Dabbelt <palmer@sifive.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg: There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 00CE 76D1 8349 60DF CE88 6DF8 EF4C A150 2CCB AB41
* remotes/riscv/tags/riscv-for-master-3.1-rc1:
riscv: spike: Fix memory leak in the board init
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | hw/riscv/spike.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c index 8a712ed490..268df04c3c 100644 --- a/hw/riscv/spike.c +++ b/hw/riscv/spike.c @@ -316,9 +316,7 @@ static void spike_v1_09_1_board_init(MachineState *machine) /* build config string with supplied memory size */ char *isa = riscv_isa_string(&s->soc.harts[0]); - size_t config_string_size = strlen(config_string_tmpl) + 48; - char *config_string = malloc(config_string_size); - snprintf(config_string, config_string_size, config_string_tmpl, + char *config_string = g_strdup_printf(config_string_tmpl, (uint64_t)memmap[SPIKE_CLINT].base + SIFIVE_TIME_BASE, (uint64_t)memmap[SPIKE_DRAM].base, (uint64_t)ram_size, isa, @@ -345,6 +343,8 @@ static void spike_v1_09_1_board_init(MachineState *machine) /* Core Local Interruptor (timer and IPI) */ sifive_clint_create(memmap[SPIKE_CLINT].base, memmap[SPIKE_CLINT].size, smp_cpus, SIFIVE_SIP_BASE, SIFIVE_TIMECMP_BASE, SIFIVE_TIME_BASE); + + g_free(config_string); } static void spike_v1_09_1_machine_init(MachineClass *mc) |