From a quick look at realloc, it may or may not return a pointer to the same allocated memory.[1] If the call to realloc returns a new pointer to a new memory allocation, then the old memory allocation has no pointer, and is not released properly (unless the caller handles it).
As a function that is supposed to reduce the burden of memory management, this one isn't very good at all. The following code validates/invalidates my right to an opinion:
void IncreaseArray(void **pArray, bool *pIsAllocated, size_t Size){
*pIsAllocated = false;
if(*pArray){
void *pTemp = *pArray;
*pTemp = realloc(*pTemp,Size);
if(*pTemp){
*pIsAllocated = true;
free(pArray);
pArray = pTemp;
}
}
else{
*pArray = malloc(Size);
if(*pArray){
*pIsAllocated = true;
}
}
}