From 4a1fbbca99c31bbb696684b62e11145899d4fb1b Mon Sep 17 00:00:00 2001 From: Richard Barry Date: Tue, 21 Jul 2009 17:25:55 +0000 Subject: [PATCH] Added a call to vApplicationMallocFailedHook() when pvPortMalloc() returns NULL. --- Source/portable/MemMang/heap_1.c | 10 ++++++++++ Source/portable/MemMang/heap_2.c | 10 ++++++++++ Source/portable/MemMang/heap_3.c | 10 ++++++++++ 3 files changed, 30 insertions(+) diff --git a/Source/portable/MemMang/heap_1.c b/Source/portable/MemMang/heap_1.c index 3e32fc0133..1829d8a11b 100644 --- a/Source/portable/MemMang/heap_1.c +++ b/Source/portable/MemMang/heap_1.c @@ -120,6 +120,16 @@ void *pvReturn = NULL; } } xTaskResumeAll(); + + #if( configUSE_MALLOC_FAILED_HOOK == 1 ) + { + if( pvReturn == NULL ) + { + extern void vApplicationMallocFailedHook( void ); + vApplicationMallocFailedHook(); + } + } + #endif return pvReturn; } diff --git a/Source/portable/MemMang/heap_2.c b/Source/portable/MemMang/heap_2.c index 7665f6904e..b15c384677 100644 --- a/Source/portable/MemMang/heap_2.c +++ b/Source/portable/MemMang/heap_2.c @@ -230,6 +230,16 @@ void *pvReturn = NULL; } xTaskResumeAll(); + #if( configUSE_MALLOC_FAILED_HOOK == 1 ) + { + if( pvReturn == NULL ) + { + extern void vApplicationMallocFailedHook( void ); + vApplicationMallocFailedHook(); + } + } + #endif + return pvReturn; } /*-----------------------------------------------------------*/ diff --git a/Source/portable/MemMang/heap_3.c b/Source/portable/MemMang/heap_3.c index 6389783c53..763d0402dd 100644 --- a/Source/portable/MemMang/heap_3.c +++ b/Source/portable/MemMang/heap_3.c @@ -74,6 +74,16 @@ void *pvReturn; } xTaskResumeAll(); + #if( configUSE_MALLOC_FAILED_HOOK == 1 ) + { + if( pvReturn == NULL ) + { + extern void vApplicationMallocFailedHook( void ); + vApplicationMallocFailedHook(); + } + } + #endif + return pvReturn; } /*-----------------------------------------------------------*/