From b645c284b5d38003bd5619372233e7272916a132 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Thu, 17 Sep 2009 21:36:52 -0600 Subject: [PATCH] fix memory leak in debug build --- src/machine.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/machine.cpp b/src/machine.cpp index 783ecb1aaf..a39931d413 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -68,9 +68,8 @@ dispose(Thread* t, Thread* o, bool remove) expect(t, find(t->m->rootThread, o)); unsigned c = count(t->m->rootThread, o); - Thread** threads = static_cast - (allocate(t->m->system, c * sizeof(Thread*))); - fill(t->m->rootThread, o, threads); + RUNTIME_ARRAY(Thread*, threads, c); + fill(t->m->rootThread, o, RUNTIME_ARRAY_BODY(threads)); #endif if (o->parent) { @@ -115,7 +114,7 @@ dispose(Thread* t, Thread* o, bool remove) expect(t, not find(t->m->rootThread, o)); for (unsigned i = 0; i < c; ++i) { - expect(t, find(t->m->rootThread, threads[i])); + expect(t, find(t->m->rootThread, RUNTIME_ARRAY_BODY(threads)[i])); } #endif }