target-ppc: Fix overallocation of opcode tables
authorStuart Brady <sdb@zubnet.me.uk>
Wed, 19 Mar 2014 14:07:26 +0000 (14:07 +0000)
committerAndreas Färber <afaerber@suse.de>
Thu, 20 Mar 2014 01:39:33 +0000 (02:39 +0100)
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 <sdb@zubnet.me.uk>
Reviewed-by: Tom Musta <tommusta@gmail.com>
Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
target-ppc/translate_init.c

index 954dee3ec27b6a00559c878b8248ec6a07f35d79..3269c3ebe44bdca9f89048afa325705323bcbf3c 100644 (file)
@@ -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);