If there are no opcodes then just delete the code space.

If there are no opcodes then the various checks access an undefined
opcode, so just delete the code space for this case.
This commit is contained in:
Cary R 2011-10-18 09:05:54 -07:00 committed by Stephen Williams
parent 59c4209347
commit 8f6062799e
1 changed files with 6 additions and 0 deletions

View File

@ -101,6 +101,12 @@ void codespace_delete(void)
{
vvp_code_t cur = first_chunk;
/* If there are no opcodes then just delete the code space. */
if (count_opcodes == 0) {
delete [] cur;
return;
}
do {
vvp_code_t next = cur[code_chunk_size-1].cptr;
for (unsigned idx = 0 ; idx < code_chunk_size; idx += 1) {