I am using a variable-sized C struct, as follows:
typedef struct {
int num_elems;
int elem1;
} mystruct;
// say I have 5 elements I would like to hold.
mystruct * ms = malloc(sizeof(mystruct) + (5-1) * sizeof(int));
ms->num_elems = 5;
// ... assign 5 elems and use struct
free(ms);
Will this last free() free everything that was malloc'd, or only sizeof(mystruct)?