In this function:
void final_delete(node **head) {
node *tmp;
tmp = *head;
while (tmp != NULL) {
tmp = tmp->next;
free(*head);
*head = tmp;
}
*head = tmp; //<-------- HERE
}
Is the reported part necessary? *head = tmp isn't it already the last step of the while loop?