Fix undefined behaviour around system_allocator, issue #133.

This commit is contained in:
Meredith L. Patterson 2015-08-02 21:32:47 +02:00
parent 0653a9e48a
commit 1ffd8d9276
12 changed files with 104 additions and 25 deletions

View file

@ -59,7 +59,7 @@ void dump_rvm_prog(HRVMProg *prog) {
symref = getsym(prog->actions[insn->arg].action);
// TODO: somehow format the argument to action
printf("%s\n", symref);
free(symref);
(&system_allocator)->free(&system_allocator, symref);
break;
case RVM_MATCH: {
uint8_t low, high;
@ -95,7 +95,7 @@ void dump_svm_prog(HRVMProg *prog, HRVMTrace *trace) {
symref = getsym(prog->actions[trace->arg].action);
// TODO: somehow format the argument to action
printf("%s\n", symref);
free(symref);
(&system_allocator)->free(&system_allocator, symref);
break;
default:
printf("\n");