From: richardbarry Date: Tue, 21 Jul 2009 17:25:55 +0000 (+0000) Subject: Added a call to vApplicationMallocFailedHook() when pvPortMalloc() returns NULL. X-Git-Tag: V5.4.1~5 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c08ca1ab57c7e810e9ba2a112bc89f0733f9bc4c;p=freertos Added a call to vApplicationMallocFailedHook() when pvPortMalloc() returns NULL. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@820 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Source/portable/MemMang/heap_1.c b/Source/portable/MemMang/heap_1.c index 3e32fc013..1829d8a11 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 7665f6904..b15c38467 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 6389783c5..763d0402d 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; } /*-----------------------------------------------------------*/