Skip to content

Commit 1d9c66a

Browse files
author
Nir Sonnenschein
authored
Merge pull request #7771 from KariHaapalehto/while1
Update mesh_system_heap_error_handler to use new error handler
2 parents 2b8eb5e + de1d9c4 commit 1d9c66a

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

features/nanostack/mbed-mesh-api/source/mesh_system.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "ns_hal_init.h"
2525
#include "include/mesh_system.h"
2626
#include "mbed_assert.h"
27+
#include "mbed_error.h"
2728
// For tracing we need to define flag, have include and define group
2829
#define HAVE_DEBUG 1
2930
#include "ns_trace.h"
@@ -46,19 +47,7 @@ MBED_CONF_MBED_MESH_API_HEAP_STAT_INFO_DEFINITION;
4647
*/
4748
static void mesh_system_heap_error_handler(heap_fail_t event)
4849
{
49-
tr_error("Heap error, mesh_system_heap_error_handler() %d", event);
50-
switch (event) {
51-
case NS_DYN_MEM_NULL_FREE:
52-
case NS_DYN_MEM_DOUBLE_FREE:
53-
case NS_DYN_MEM_ALLOCATE_SIZE_NOT_VALID:
54-
case NS_DYN_MEM_POINTER_NOT_VALID:
55-
case NS_DYN_MEM_HEAP_SECTOR_CORRUPTED:
56-
case NS_DYN_MEM_HEAP_SECTOR_UNITIALIZED:
57-
break;
58-
default:
59-
break;
60-
}
61-
while (1);
50+
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_NETWORK_STACK, MBED_ERROR_CODE_OUT_OF_MEMORY), "Heap error, mesh_system_heap_error_handler()", event);
6251
}
6352

6453
void mesh_system_init(void)

0 commit comments

Comments
 (0)