diff options
-rw-r--r-- | lib/tlsf/src/tlsf.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/tlsf/src/tlsf.c b/lib/tlsf/src/tlsf.c index 9df176ce16..3d11f60393 100644 --- a/lib/tlsf/src/tlsf.c +++ b/lib/tlsf/src/tlsf.c | |||
@@ -695,7 +695,7 @@ void destroy_memory_pool(void *mem_pool) | |||
695 | void *tlsf_malloc(size_t size) | 695 | void *tlsf_malloc(size_t size) |
696 | { | 696 | { |
697 | /******************************************************************/ | 697 | /******************************************************************/ |
698 | void *ret; | 698 | void *ret = NULL; |
699 | 699 | ||
700 | #if USE_MMAP || USE_SBRK || defined(ROCKBOX) | 700 | #if USE_MMAP || USE_SBRK || defined(ROCKBOX) |
701 | if (!mp) { | 701 | if (!mp) { |
@@ -710,12 +710,14 @@ void *tlsf_malloc(size_t size) | |||
710 | init_memory_pool(area_size, area); | 710 | init_memory_pool(area_size, area); |
711 | } | 711 | } |
712 | #endif | 712 | #endif |
713 | if (mp) | ||
714 | { | ||
715 | TLSF_ACQUIRE_LOCK(&((tlsf_t *)mp)->lock); | ||
713 | 716 | ||
714 | TLSF_ACQUIRE_LOCK(&((tlsf_t *)mp)->lock); | 717 | ret = malloc_ex(size, mp); |
715 | |||
716 | ret = malloc_ex(size, mp); | ||
717 | 718 | ||
718 | TLSF_RELEASE_LOCK(&((tlsf_t *)mp)->lock); | 719 | TLSF_RELEASE_LOCK(&((tlsf_t *)mp)->lock); |
720 | } | ||
719 | 721 | ||
720 | return ret; | 722 | return ret; |
721 | } | 723 | } |