From 7e3ef27c7c1ccbac589ad0a67c40b5df57e2af71 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 31 May 2018 14:50:52 +0100 Subject: arm: fix malloc type mismatch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cpregs_keys is an uint32_t* so the allocation should use uint32_t. g_new is even better because it is type-safe. Signed-off-by: Paolo Bonzini Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Peter Maydell --- target/arm/gdbstub.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'target/arm/gdbstub.c') diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c index e80cfb47c7..0c64c0292e 100644 --- a/target/arm/gdbstub.c +++ b/target/arm/gdbstub.c @@ -157,8 +157,7 @@ int arm_gen_dynamic_xml(CPUState *cs) RegisterSysregXmlParam param = {cs, s}; cpu->dyn_xml.num_cpregs = 0; - cpu->dyn_xml.cpregs_keys = g_malloc(sizeof(uint32_t *) * - g_hash_table_size(cpu->cp_regs)); + cpu->dyn_xml.cpregs_keys = g_new(uint32_t, g_hash_table_size(cpu->cp_regs)); g_string_printf(s, ""); g_string_append_printf(s, ""); g_string_append_printf(s, ""); -- cgit v1.2.3