malloc: replace panics with error messages

We shouldn't ever panic in libraries, let alone in EAL, so
replace all panic messages with error messages.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
This commit is contained in:
Anatoly Burakov 2018-04-11 13:29:44 +01:00 committed by Thomas Monjalon
parent 883179b493
commit d1162b77c9

View File

@ -30,7 +30,7 @@ void rte_free(void *addr)
{
if (addr == NULL) return;
if (malloc_heap_free(malloc_elem_from_data(addr)) < 0)
rte_panic("Fatal error: Invalid memory\n");
RTE_LOG(ERR, EAL, "Error: Invalid memory\n");
}
/*
@ -134,8 +134,10 @@ rte_realloc(void *ptr, size_t size, unsigned align)
return rte_malloc(NULL, size, align);
struct malloc_elem *elem = malloc_elem_from_data(ptr);
if (elem == NULL)
rte_panic("Fatal error: memory corruption detected\n");
if (elem == NULL) {
RTE_LOG(ERR, EAL, "Error: memory corruption detected\n");
return NULL;
}
size = RTE_CACHE_LINE_ROUNDUP(size), align = RTE_CACHE_LINE_ROUNDUP(align);
/* check alignment matches first, and if ok, see if we can resize block */