diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2017-06-05 15:28:12 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2017-06-05 15:28:12 +0100 |
commit | 199e19ee538eb61fd08b1c1ee5aa838ebdcc968e (patch) | |
tree | 2d2bfa6513c3d6bfd82e8e1e37e0db4941b19788 /hw/xtensa | |
parent | cb8b8ef4578dc17c350fd4b27700a9f178e2dad0 (diff) | |
parent | 03e947f9c2264356aef037e6bf9c496b5deae2d2 (diff) | |
download | qemu-199e19ee538eb61fd08b1c1ee5aa838ebdcc968e.zip qemu-199e19ee538eb61fd08b1c1ee5aa838ebdcc968e.tar.gz qemu-199e19ee538eb61fd08b1c1ee5aa838ebdcc968e.tar.bz2 |
Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-fetch' into staging
trivial patches for 2017-06-05
# gpg: Signature made Mon 05 Jun 2017 15:23:46 BST
# gpg: using RSA key 0x701B4F6B1A693E59
# gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>"
# gpg: aka "Michael Tokarev <mjt@corpit.ru>"
# gpg: aka "Michael Tokarev <mjt@debian.org>"
# Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D 4324 457C E0A0 8044 65C5
# Subkey fingerprint: 7B73 BAD6 8BE7 A2C2 8931 4B22 701B 4F6B 1A69 3E59
* remotes/mjt/tags/trivial-patches-fetch: (21 commits)
hw/core: nmi.c can be compiled as common-obj nowadays
dump: fix memory_mapping_filter leak
ide-test: check return of fwrite
help: Add newline to end of thread option help text
qemu-ga: remove useless allocation
scsi/lsi53c895a: Remove unused lsi_mem_*() return value
qapi: Fix some QMP documentation regressions
hw/mips: add missing include
register: display register prefix (name) since it is available
hw/sparc: use ARRAY_SIZE() macro
hw/xtensa: sim: use g_string/g_new
target/arm: add data cache invalidation cp15 instruction to cortex-r5
block: Correct documentation for BLOCK_WRITE_THRESHOLD
trivial: Remove unneeded ifndef in memory.h
altera_timer: fix incorrect memset
configure: Detect native NetBSD curses(3)
tests/libqtest: Print error instead of aborting when env variable is missing
docs/qdev-device-use.txt: update section Default Devices
docs qemu-doc: Avoid ide-drive, it's deprecated
qemu-doc: Add hyperlinks to further license information
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/xtensa')
-rw-r--r-- | hw/xtensa/sim.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/hw/xtensa/sim.c b/hw/xtensa/sim.c index d2d1d3a..b27e28d 100644 --- a/hw/xtensa/sim.c +++ b/hw/xtensa/sim.c @@ -41,21 +41,21 @@ static void xtensa_create_memory_regions(const XtensaMemory *memory, const char *name) { unsigned i; - char *num_name = malloc(strlen(name) + sizeof(i) * 3 + 1); + GString *num_name = g_string_new(NULL); for (i = 0; i < memory->num; ++i) { MemoryRegion *m; - sprintf(num_name, "%s%u", name, i); - m = g_malloc(sizeof(*m)); - memory_region_init_ram(m, NULL, num_name, + g_string_printf(num_name, "%s%u", name, i); + m = g_new(MemoryRegion, 1); + memory_region_init_ram(m, NULL, num_name->str, memory->location[i].size, &error_fatal); vmstate_register_ram_global(m); memory_region_add_subregion(get_system_memory(), memory->location[i].addr, m); } - free(num_name); + g_string_free(num_name, true); } static uint64_t translate_phys_addr(void *opaque, uint64_t addr) |