tdelete(3): don't delete the node we are about to return.

CID:		272528
Obtained from:	NetBSD (CVS rev. 1.4)
MFC after:	2 weeks
This commit is contained in:
Pedro F. Giffuni 2015-02-05 23:02:43 +00:00
parent 5262b957d4
commit b20592de1b

View File

@ -65,7 +65,8 @@ tdelete(const void * __restrict vkey, void ** __restrict vrootp,
q->rlink = (*rootp)->rlink;
}
}
free(*rootp); /* D4: Free node */
if (p != *rootp)
free(*rootp); /* D4: Free node */
*rootp = q; /* link parent to new node */
return p;
}