Hello,
we make use of realloc with a pointer to pointer and the result is this assertion:
ti.sysbios.heaps.HeapMem: line 348: assertion failure: A_invalidFree: Invalid free
xdc.runtime.Error.raise: terminating execution
We tested our code on a x86 platform to verify the correct use of the pointers and the code runs fine.
Either the realloc implementation in SYSBIOS is faulty, either the memory allocation in CC3200 presents some issue that we may not be aware of.
The code to test:
*readBuffer = malloc(500 * sizeof(unsigned char)); [...]
HTTPCli_getResponseField(httpClient, (char *)*readBuffer, 500, &moreFlags)
[...]
len = strtoul((char *)*readBuffer, NULL, 0); *readBuffer = realloc(*readBuffer, (len + 1) * sizeof(unsigned char));
readBuffer is a valid string and contains data got from HTTP, we can read it with debugger, do strcmp and other operations without issues.
In other parts of the application we use realloc with pointers (and not pointers to pointers such as here) and it works fine.