I'm in doubt about implementing the method of releasing memory from a chained circular list:
void liberarLista() {
if(head == NULL)
return; //retorna original(NULL);
lista *aux, *temp = head;
while(temp->prox != head) {
aux = temp;
temp = temp->prox;
free(aux);
}
head = NULL;
}
In the material I am reading it releases after the while the head, but there is segmentatium fault, but I do not know if it is necessary since the aux releases the first node (head);