summaryrefslogtreecommitdiff
path: root/sys/dev/ccd.c
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>1995-12-08 19:13:26 +0000
committerthorpej <thorpej@NetBSD.org>1995-12-08 19:13:26 +0000
commit7268bf552d3dde0d962e2da56bb3451e50e09c52 (patch)
treeabac863c07b1c851a185d3919e2af6e3b306dae9 /sys/dev/ccd.c
parentd7cef923aca09db8730cd36993b1a446b038d94b (diff)
When unconfiguring a ccd, only free as many interleave indices as
were allocated, which may not be the same as the number of components in the ccd. From Don Lewis <gdonl@gv.ssi1.com>. Fixes PR #1820.
Diffstat (limited to 'sys/dev/ccd.c')
-rw-r--r--sys/dev/ccd.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/ccd.c b/sys/dev/ccd.c
index ef1456f17eb..c8d33a4b867 100644
--- a/sys/dev/ccd.c
+++ b/sys/dev/ccd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ccd.c,v 1.21 1995/11/06 19:58:01 thorpej Exp $ */
+/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */
/*
* Copyright (c) 1995 Jason R. Thorpe.
@@ -1093,6 +1093,8 @@ ccdioctl(dev, cmd, data, flag, p)
/*
* Free ccd_softc information and clear entry.
*/
+
+ /* Close the components and free their pathnames. */
for (i = 0; i < cs->sc_nccdisks; ++i) {
/*
* XXX: this close could potentially fail and
@@ -1107,8 +1109,13 @@ ccdioctl(dev, cmd, data, flag, p)
(void)vn_close(cs->sc_cinfo[i].ci_vp, FREAD|FWRITE,
p->p_ucred, p);
free(cs->sc_cinfo[i].ci_path, M_DEVBUF);
- free(cs->sc_itable[i].ii_index, M_DEVBUF);
}
+
+ /* Free interleave index. */
+ for (i = 0; cs->sc_itable[i].ii_ndisk; ++i)
+ free(cs->sc_itable[i].ii_index, M_DEVBUF);
+
+ /* Free component info and interleave table. */
free(cs->sc_cinfo, M_DEVBUF);
free(cs->sc_itable, M_DEVBUF);
cs->sc_flags &= ~CCDF_INITED;