typedef struct A
{
int* whatever;
} A;
int main(void)
{
A* foo = (A)malloc(sizeof(A));
foo->whatever = (int)malloc(sizeof(int));
free(A); // leak? (foo->whatever)
return 0;
}
Do I have to free each component of a struct / composite data type, or can I just free the struct?