I'm trying to free these linked lists and i get no compile errors but valgrind is saying "30 allocs, 14 frees, 6,377 bytes allocated ".
Shouldn't this function wipe all the allocations in the lists.
void free_mem(struct medico *head_m, struct paciente *head_p ,
struct consulta *head_c)
struct medico *tmp_m = NULL;
struct paciente *tmp_p = NULL;
struct consulta *tmp_c = NULL;
tmp_m = head_m->next;
head_m = tmp_m;
tmp_p = head_p->next;
head_p = tmp_p;
tmp_c = head_c->next;
head_c = tmp_c;
Your loop conditions are wrong:
head_m is not NULL, the loop is never executed. To fix, remove