Properly un-giant-trick the cdevsw in fini_cdevsw()

Tripped over by:	Huang wen hui <huang@gddsn.org.cn>
This commit is contained in:
Poul-Henning Kamp 2005-08-20 12:13:51 +00:00
parent efd9ac0dfc
commit 1d45c50ec3

View File

@ -443,10 +443,14 @@ umajor(dev_t dev)
static void
fini_cdevsw(struct cdevsw *devsw)
{
struct cdevsw *gt;
if (devsw->d_gianttrick != NULL)
free(devsw->d_gianttrick, M_DEVT);
devsw->d_gianttrick = NULL;
if (devsw->d_gianttrick != NULL) {
gt = devsw->d_gianttrick;
memcpy(devsw, gt, sizeof *devsw);
free(gt, M_DEVT);
devsw->d_gianttrick = NULL;
}
devsw->d_flags &= ~D_INIT;
}