@@ -132,17 +132,15 @@ void init_signals(void) {
132132Stats terminate(VM* vm) {
133133 Stats stats = vm->stats;
134134 STATS_ENTER_EXIT(stats)
135−#ifdef HAS_PTHREAD
136− free(vm->inbox);
137−#endif
138135 free(vm->valstack);
139136 free_heap(&(vm->heap));
140137 c_heap_destroy(&(vm->c_heap));
141138#ifdef HAS_PTHREAD
142− pthread_mutex_destroy(&(vm -> inbox_lock));
143− pthread_mutex_destroy(&(vm -> inbox_block));
139+ pthread_mutex_destroy(&(vm->inbox_lock));
140+ pthread_mutex_destroy(&(vm->inbox_block));
144141 pthread_mutex_destroy(&(vm->alloc_lock));
145− pthread_cond_destroy(&(vm -> inbox_waiting));
142+ pthread_cond_destroy(&(vm->inbox_waiting));
143+ free(vm->inbox);
146144#endif
147145 // free(vm);
148146 // Set the VM as inactive, so that if any message gets sent to it