diff options
author | lloyd <[email protected]> | 2010-09-26 17:07:21 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-09-26 17:07:21 +0000 |
commit | 6e71a3c9eeb838a79d82b19137f1c11b0e58c974 (patch) | |
tree | da5457cb231efe0c993f1e76ed85d027c9eb43d9 | |
parent | edd522e5ceb31180eed22c2f1bcae50e4f79c2ae (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.
-rw-r--r-- | src/alloc/system_alloc/defalloc.cpp | 4 |
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(); } /* |