Print this page
dss_paths[] entries need cleanup too
*** 813,824 ****
sip->dss_npaths = dss_npaths;
sip->dss_paths = kmem_alloc(dss_npaths *
sizeof (rfs4_dss_path_t *), KM_SLEEP);
for (i = 0; i < dss_npaths; i++) {
! /* CSTYLED */
! sip->dss_paths[i] = rfs4_dss_newpath(nsrv4, sip, dss_paths[i], i);
}
mutex_enter(&nsrv4->servinst_lock);
if (nsrv4->nfs4_cur_servinst != NULL) {
/* add to linked list */
--- 813,824 ----
sip->dss_npaths = dss_npaths;
sip->dss_paths = kmem_alloc(dss_npaths *
sizeof (rfs4_dss_path_t *), KM_SLEEP);
for (i = 0; i < dss_npaths; i++) {
! sip->dss_paths[i] =
! rfs4_dss_newpath(nsrv4, sip, dss_paths[i], i);
}
mutex_enter(&nsrv4->servinst_lock);
if (nsrv4->nfs4_cur_servinst != NULL) {
/* add to linked list */
*** 852,864 ****
for (sip = current; sip != NULL; sip = prev) {
prev = sip->prev;
rw_destroy(&sip->rwlock);
if (sip->oldstate)
kmem_free(sip->oldstate, sizeof (rfs4_oldstate_t));
! if (sip->dss_paths)
kmem_free(sip->dss_paths,
sip->dss_npaths * sizeof (rfs4_dss_path_t *));
kmem_free(sip, sizeof (rfs4_servinst_t));
#ifdef DEBUG
n++;
#endif
}
--- 852,880 ----
for (sip = current; sip != NULL; sip = prev) {
prev = sip->prev;
rw_destroy(&sip->rwlock);
if (sip->oldstate)
kmem_free(sip->oldstate, sizeof (rfs4_oldstate_t));
! if (sip->dss_paths) {
! int i = sip->dss_npaths;
!
! while (i > 0) {
! i--;
! if (sip->dss_paths[i] != NULL) {
! char *path = sip->dss_paths[i]->path;
!
! if (path != NULL) {
! kmem_free(path,
! strlen(path) + 1);
! }
! kmem_free(sip->dss_paths[i],
! sizeof (rfs4_dss_path_t));
! }
! }
kmem_free(sip->dss_paths,
sip->dss_npaths * sizeof (rfs4_dss_path_t *));
+ }
kmem_free(sip, sizeof (rfs4_servinst_t));
#ifdef DEBUG
n++;
#endif
}