From e0589a097ecc90b16521a394589d15741c5244d0 Mon Sep 17 00:00:00 2001 From: gbeauche <> Date: Sat, 28 Jan 2006 21:59:41 +0000 Subject: [PATCH] fix new/delete mismatch in slow_allocator, also use that for lazy_allocator --- SheepShaver/src/kpx_cpu/include/block-alloc.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SheepShaver/src/kpx_cpu/include/block-alloc.hpp b/SheepShaver/src/kpx_cpu/include/block-alloc.hpp index ce1c7ab1..70217e40 100644 --- a/SheepShaver/src/kpx_cpu/include/block-alloc.hpp +++ b/SheepShaver/src/kpx_cpu/include/block-alloc.hpp @@ -32,7 +32,7 @@ template< class data > struct slow_allocator { data * acquire() const { return new data; } - void release(data * const x) const { free(x); } + void release(data * const x) const { delete x; } }; /** @@ -77,7 +77,7 @@ lazy_allocator::~lazy_allocator() while (p) { pool * d = p; p = p->next; - free(d); + delete d; } } @@ -87,7 +87,7 @@ data * lazy_allocator::acquire() if (!chunks) { // There is no chunk left, allocate a new pool and link the // chunks into the free list - pool * p = (pool *)malloc(sizeof(pool)); + pool * p = new pool; for (chunk * c = &p->chunks[0]; c < &p->chunks[pool_count]; c++) { c->next = chunks; chunks = c;