This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3230SF: Free function causing memory heap crash

Part Number: CC3230SF

Tool/software:

Using SDK-7 , application uses the heapMem with gateMutex:

With the heapsize configured to : HEAPSIZE = 0x10000; and plenty of space remaining the function fails to free memory. This never happens on every free call because the same function allocates(Memory_alloc) memory and free it three times during the function call.

Debugging into the function free(ptr);, i found that the size parameter in the below function is corrupted(536892040) and calls: HeapMem_freeUnprotected.

/*
* ======== Memory_free ========
*/
void Memory_free(IHeap_Handle heap, void * block, size_t size)
{
if (heap == NULL) {
heap = Memory_defaultHeapInstance;
}

heap->free(heap, block, size);
}

before crashing:

Question: this happens because the application is calling Memory_alloc and uses free() to free?  previously, I was using malloc and that was causing crash.