free_list(struct list *listp)
{
while (listp != NULL) {
struct list *nextp;

nextp = listp->next;
free(listp);
listp = nextp;
}
}

list構造ならfreeはこんな感じですればいいと思いますが

tree構造
struct tree{
int val;
struct tree *left;
struct tree *right;
};
みたいな時には再起を使わずにかけますか?