Merge pull request #7771 from KariHaapalehto/while1

Update mesh_system_heap_error_handler to use new error handler
pull/7793/head
Nir Sonnenschein 2018-08-14 19:43:15 +03:00 committed by GitHub
commit 1d9c66af82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 13 deletions

View File

@ -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)