about summary refs log tree commit diff
path: root/src/rt/rust_task.cpp
diff options
context:
space:
mode:
authorEric Holk <eholk@mozilla.com>2011-08-12 16:36:17 -0700
committerEric Holk <eholk@mozilla.com>2011-08-15 09:26:51 -0700
commitb9f1f77622c7a52b0eba39eb05c7841f5407f938 (patch)
tree685923e8a2fa4e2796a54280a878b540b0ab169e /src/rt/rust_task.cpp
parent2f23405a6079745663b9a4462410aa509f281aa1 (diff)
downloadrust-b9f1f77622c7a52b0eba39eb05c7841f5407f938.tar.gz
rust-b9f1f77622c7a52b0eba39eb05c7841f5407f938.zip
Fixed memory accounting and task stack creation bugs.
Diffstat (limited to 'src/rt/rust_task.cpp')
-rw-r--r--src/rt/rust_task.cpp7
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();