How do I free memory allocated to a void* member of a struct in my c project without breaking my GoogleTest project?

Advertisements I’m trying to free all the memory allocated in testing_malloc() with the method testing_free(). I am using a Google Test project to test my code and the MemoryLeakDetector mentioned in this answer. However, when I try to free the private_data I get the following heap corruption error. HEAP CORRUPTION DETECTED: after Normal block (#835)… Read More How do I free memory allocated to a void* member of a struct in my c project without breaking my GoogleTest project?

Why am I getting an invalid pointer error when I try to free malloced pointers?

Advertisements I’m trying to learn about how arrays of strings can be created in C using malloc (i.e. dynamically sized arrays of strings). I can get everything working but I’m getting an "invalid pointer" error when I try to free the char* pointers stored in namesArray->data[0] and namesArray->data[1] But if I don’t use free on… Read More Why am I getting an invalid pointer error when I try to free malloced pointers?