diff options
Diffstat (limited to 'src/rt/rust_task.cpp')
| -rw-r--r-- | src/rt/rust_task.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index a03388a2a55..1a28e6fb947 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -108,8 +108,13 @@ struct spawn_args { }; extern "C" CDECL -void task_exit(void *env, int rval, rust_task *task) { +void task_exit(intptr_t *env, int rval, rust_task *task) { LOG(task, task, "task exited with value %d", rval); + if(env) { + // free the environment. + I(task->sched, 1 == *env); // the ref count better be 1 + task->free(env); + } task->die(); task->lock.lock(); task->notify_tasks_waiting_to_join(); |
