From 7268bf552d3dde0d962e2da56bb3451e50e09c52 Mon Sep 17 00:00:00 2001 From: thorpej Date: Fri, 8 Dec 1995 19:13:26 +0000 Subject: 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 . Fixes PR #1820. --- sys/dev/ccd.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'sys/dev') 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; -- cgit