summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author[email protected] <[email protected]>2011-01-24 13:25:36 +0000
committer[email protected] <[email protected]>2011-01-24 13:25:36 +0000
commit86e7b772c2d9a768dc774cd470e08312a224ce43 (patch)
treed40aa334366b1512a4c01d80b53c28b9915fe767 /src
parent2aeee86c5f4db5a4c92ecfa3b4389567eb8f2349 (diff)
add object allocation check.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1258 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'src')
-rw-r--r--src/mempool.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/mempool.c b/src/mempool.c
index 4232d38a3a..5267a98fa1 100644
--- a/src/mempool.c
+++ b/src/mempool.c
@@ -16,6 +16,7 @@
* 2006-08-10 Bernard fix interrupt bug in rt_mp_alloc
* 2010-07-13 Bernard fix RT_ALIGN issue found by kuronca
* 2010-10-26 yi.qiu add module support in rt_mp_delete
+ * 2011-01-24 Bernard add object allocation check.
*/
#include <rthw.h>
@@ -183,6 +184,7 @@ rt_mp_t rt_mp_create(const char* name, rt_size_t block_count, rt_size_t block_si
/* allocate object */
mp = (struct rt_mempool*)rt_object_allocate(RT_Object_Class_MemPool, name);
+ if (mp == RT_NULL) return RT_NULL; /* allocate object failed */
/* init memory pool */
mp->block_size = RT_ALIGN(block_size, RT_ALIGN_SIZE);