In unionfs_hashrem(), use LIST_FOREACH_SAFE when iterating over

the list of nodes to free them.

CID:		1668
Found by:	Coverity Prevent (tm)
This commit is contained in:
Craig Rodrigues 2006-12-09 16:27:50 +00:00
parent 37ec86bb1b
commit acc4bab11b

View File

@ -317,7 +317,7 @@ unionfs_hashrem(struct vnode *vp, struct thread *td)
{
int vfslocked;
struct unionfs_node *unp;
struct unionfs_node_status *unsp;
struct unionfs_node_status *unsp, *unsp_tmp;
struct vnode *lvp;
struct vnode *uvp;
@ -367,7 +367,8 @@ unionfs_hashrem(struct vnode *vp, struct thread *td)
free(unp->un_path, M_UNIONFSPATH);
unp->un_path = NULL;
}
while ((unsp = LIST_FIRST(&(unp->un_unshead))), NULL != unsp) {
LIST_FOREACH_SAFE(unsp, &(unp->un_unshead), uns_list, unsp_tmp) {
LIST_REMOVE(unsp, uns_list);
free(unsp, M_TEMP);
}