From de1d9c45b6712acee6f5bcf0c87029a947fd350d Mon Sep 17 00:00:00 2001 From: Kari Haapalehto Date: Mon, 13 Aug 2018 14:39:49 +0300 Subject: [PATCH] Update mesh_system_heap_error_handler to use new error codes and mbed_error call --- .../nanostack/mbed-mesh-api/source/mesh_system.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/features/nanostack/mbed-mesh-api/source/mesh_system.c b/features/nanostack/mbed-mesh-api/source/mesh_system.c index 3772f64cda..3081d8daa2 100644 --- a/features/nanostack/mbed-mesh-api/source/mesh_system.c +++ b/features/nanostack/mbed-mesh-api/source/mesh_system.c @@ -24,6 +24,7 @@ #include "ns_hal_init.h" #include "include/mesh_system.h" #include "mbed_assert.h" +#include "mbed_error.h" // For tracing we need to define flag, have include and define group #define HAVE_DEBUG 1 #include "ns_trace.h" @@ -46,19 +47,7 @@ MBED_CONF_MBED_MESH_API_HEAP_STAT_INFO_DEFINITION; */ static void mesh_system_heap_error_handler(heap_fail_t event) { - tr_error("Heap error, mesh_system_heap_error_handler() %d", event); - switch (event) { - case NS_DYN_MEM_NULL_FREE: - case NS_DYN_MEM_DOUBLE_FREE: - case NS_DYN_MEM_ALLOCATE_SIZE_NOT_VALID: - case NS_DYN_MEM_POINTER_NOT_VALID: - case NS_DYN_MEM_HEAP_SECTOR_CORRUPTED: - case NS_DYN_MEM_HEAP_SECTOR_UNITIALIZED: - break; - default: - break; - } - while (1); + MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_NETWORK_STACK, MBED_ERROR_CODE_OUT_OF_MEMORY), "Heap error, mesh_system_heap_error_handler()", event); } void mesh_system_init(void)