aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc/system_alloc
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-09-26 17:07:21 +0000
committerlloyd <[email protected]>2010-09-26 17:07:21 +0000
commit6e71a3c9eeb838a79d82b19137f1c11b0e58c974 (patch)
treeda5457cb231efe0c993f1e76ed85d027c9eb43d9 /src/alloc/system_alloc
parentedd522e5ceb31180eed22c2f1bcae50e4f79c2ae (diff)
Malloc_Allocator isn't a pool, so it needs to fail directly if malloc
fails, not just return 0 since callers expect that the allocator will either succeed or throw.
Diffstat (limited to 'src/alloc/system_alloc')
-rw-r--r--src/alloc/system_alloc/defalloc.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/alloc/system_alloc/defalloc.cpp b/src/alloc/system_alloc/defalloc.cpp
index 311057462..596deb3d0 100644
--- a/src/alloc/system_alloc/defalloc.cpp
+++ b/src/alloc/system_alloc/defalloc.cpp
@@ -54,7 +54,9 @@ void do_free(void* ptr, u32bit n, bool do_lock)
*/
void* Malloc_Allocator::allocate(u32bit n)
{
- return do_malloc(n, false);
+ void* ptr = do_malloc(n, false);
+ if(!ptr)
+ throw Memory_Exhaustion();
}
/*