From: Stuart Brady Date: Wed, 19 Mar 2014 14:07:26 +0000 (+0000) Subject: target-ppc: Fix overallocation of opcode tables X-Git-Tag: qemu-xen-4.5.0-rc1~88^2~9 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=a80172a4762465a40f6b59d10d64360bd272b700;p=qemu-xen.git target-ppc: Fix overallocation of opcode tables create_new_table() should allocate 0x20 opc_handler_t pointers, but actually allocates 0x20 opc_handler_t structs. Fix this. Signed-off-by: Stuart Brady Reviewed-by: Tom Musta Tested-by: Tom Musta Signed-off-by: Andreas Färber --- diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c index 954dee3ec2..3269c3ebe4 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -7434,7 +7434,7 @@ static int create_new_table (opc_handler_t **table, unsigned char idx) { opc_handler_t **tmp; - tmp = g_malloc(0x20 * sizeof(opc_handler_t)); + tmp = g_new(opc_handler_t *, 0x20); fill_new_table(tmp, 0x20); table[idx] = (opc_handler_t *)((uintptr_t)tmp | PPC_INDIRECT);