summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cheat.c
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2010-01-11 02:37:17 +0000
committer Aaron Giles <aaron@aarongiles.com>2010-01-11 02:37:17 +0000
commitd51551f3032ef08e8d29506b2230a70cf948bb53 (patch)
tree95efce783b0e346460faa5337c9c7479b41bce40 /src/emu/cheat.c
parent6605a2e3e57adf0a497ea563de287af366d3c07c (diff)
Fix cheat crash and comment display.
Diffstat (limited to 'src/emu/cheat.c')
-rw-r--r--src/emu/cheat.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/emu/cheat.c b/src/emu/cheat.c
index 2e1d7628c60..b4a6bdc36cb 100644
--- a/src/emu/cheat.c
+++ b/src/emu/cheat.c
@@ -193,7 +193,7 @@ struct _cheat_entry
script_state state; /* current cheat state */
UINT32 numtemp; /* number of temporary variables */
UINT64 argindex; /* argument index variable */
- UINT64 tempvar[1]; /* value of the temporary variables */
+ UINT64 * tempvar; /* value of the temporary variables */
};
@@ -1177,7 +1177,8 @@ static cheat_entry *cheat_entry_load(running_machine *machine, const char *filen
}
/* allocate memory for the cheat */
- cheat = (cheat_entry *)auto_alloc_array_clear(machine, UINT8, sizeof(*cheat) + (tempcount - 1) * sizeof(cheat->tempvar));
+ cheat = auto_alloc_clear(machine, cheat_entry);
+ cheat->tempvar = auto_alloc_array_clear(machine, UINT64, tempcount);
cheat->numtemp = tempcount;
/* get the description */
@@ -1324,6 +1325,7 @@ static void cheat_entry_free(running_machine *machine, cheat_entry *cheat)
if (cheat->symbols != NULL)
symtable_free(cheat->symbols);
+ auto_free(machine, cheat->tempvar);
auto_free(machine, cheat);
}