Yeah, you free everything. It is a good question though, not very clear in the beggining.
As a rule, you free() EXACTLY what you malloc.
So just lookup whatever malloc you have and put the appropriate free(). You might also want to free() int the opposite order you malloc. That will save you some error in some memory allocation situations.
Consider the following. You want to malloc memory for each array of characters (string) that *name will point at:
Code:
MALLOC:
values=(item_t *) malloc (10*sizeof(item_t));
for (int i=0; i < 10; ++i)
values[i].name = (char *)malloc(100*sizeof(char));
FREE:
for (int i=0; i < 10; ++i)
free(values[i].name); //opposite order, first the last malloc
free(values); //opposite order, second the first malloc
//Two mallocs, two frees
You do the opposite order for obvious reasons. If you de-allocate values then values[i].name won't be a valid accessed pointer because values would have already be freed