Print this page
dss_paths[] entries need cleanup too

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/nfs/nfs4_srv.c
          +++ new/usr/src/uts/common/fs/nfs/nfs4_srv.c
↓ open down ↓ 807 lines elided ↑ open up ↑
 808  808          oldstate->next = oldstate;
 809  809          oldstate->prev = oldstate;
 810  810          sip->oldstate = oldstate;
 811  811  
 812  812  
 813  813          sip->dss_npaths = dss_npaths;
 814  814          sip->dss_paths = kmem_alloc(dss_npaths *
 815  815              sizeof (rfs4_dss_path_t *), KM_SLEEP);
 816  816  
 817  817          for (i = 0; i < dss_npaths; i++) {
 818      -                /* CSTYLED */
 819      -                sip->dss_paths[i] = rfs4_dss_newpath(nsrv4, sip, dss_paths[i], i);
      818 +                sip->dss_paths[i] =
      819 +                    rfs4_dss_newpath(nsrv4, sip, dss_paths[i], i);
 820  820          }
 821  821  
 822  822          mutex_enter(&nsrv4->servinst_lock);
 823  823          if (nsrv4->nfs4_cur_servinst != NULL) {
 824  824                  /* add to linked list */
 825  825                  sip->prev = nsrv4->nfs4_cur_servinst;
 826  826                  nsrv4->nfs4_cur_servinst->next = sip;
 827  827          }
 828  828          if (start_grace)
 829  829                  rfs4_grace_start(sip);
↓ open down ↓ 17 lines elided ↑ open up ↑
 847  847  
 848  848          mutex_enter(&nsrv4->servinst_lock);
 849  849          ASSERT(nsrv4->nfs4_cur_servinst != NULL);
 850  850          current = nsrv4->nfs4_cur_servinst;
 851  851          nsrv4->nfs4_cur_servinst = NULL;
 852  852          for (sip = current; sip != NULL; sip = prev) {
 853  853                  prev = sip->prev;
 854  854                  rw_destroy(&sip->rwlock);
 855  855                  if (sip->oldstate)
 856  856                          kmem_free(sip->oldstate, sizeof (rfs4_oldstate_t));
 857      -                if (sip->dss_paths)
      857 +                if (sip->dss_paths) {
      858 +                        int i = sip->dss_npaths;
      859 +
      860 +                        while (i > 0) {
      861 +                                i--;
      862 +                                if (sip->dss_paths[i] != NULL) {
      863 +                                        char *path = sip->dss_paths[i]->path;
      864 +
      865 +                                        if (path != NULL) {
      866 +                                                kmem_free(path,
      867 +                                                    strlen(path) + 1);
      868 +                                        }
      869 +                                        kmem_free(sip->dss_paths[i],
      870 +                                            sizeof (rfs4_dss_path_t));
      871 +                                }
      872 +                        }
 858  873                          kmem_free(sip->dss_paths,
 859  874                              sip->dss_npaths * sizeof (rfs4_dss_path_t *));
      875 +                }
 860  876                  kmem_free(sip, sizeof (rfs4_servinst_t));
 861  877  #ifdef DEBUG
 862  878                  n++;
 863  879  #endif
 864  880          }
 865  881          mutex_exit(&nsrv4->servinst_lock);
 866  882  }
 867  883  
 868  884  /*
 869  885   * Assign the current server instance to a client_t.
↓ open down ↓ 9217 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX