diff options
| author | Raghavendra Bhat <raghavendra@redhat.com> | 2013-07-25 01:14:48 +0530 | 
|---|---|---|
| committer | Anand Avati <avati@redhat.com> | 2013-10-03 21:32:43 -0700 | 
| commit | dcfe4ab475c53cec7d117fb8052b26213a4b41db (patch) | |
| tree | 4a18f76152b1779077315f49fadd0cee5c24a587 /libglusterfs/src/xlator.c | |
| parent | a25bd2d7695760c9fe35fec39065c9326f2952d6 (diff) | |
glusterfsd, libgfapi: destroy the temporary graphs constructed for comparison
* The new and the oldgraphs which have been constructed whenever there is
  a volfile change (either reconfigure of the existing graph or creating
  a new graph) for comparison should be freed. Otherwise frequent graph
  changes will lead to huge memory leak
Change-Id: I4faddb1aa9393b34cd2de6732e537a60f600026a
BUG: 948178
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/5388
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfs/src/xlator.c')
| -rw-r--r-- | libglusterfs/src/xlator.c | 43 | 
1 files changed, 27 insertions, 16 deletions
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index a7caedf02e7..d029475504a 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -538,10 +538,26 @@ out:          return;  } +int +xlator_list_destroy (xlator_list_t *list) +{ +        xlator_list_t *next = NULL; + +        while (list) { +                next = list->next; +                GF_FREE (list); +                list = next; +        } + +        return 0; +} +  int  xlator_tree_free (xlator_t *tree)  { +        volume_opt_list_t *vol_opt = NULL; +        volume_opt_list_t *tmp     = NULL;          xlator_t *trav = tree;          xlator_t *prev = tree; @@ -552,9 +568,19 @@ xlator_tree_free (xlator_t *tree)          while (prev) {                  trav = prev->next; -                dict_destroy (prev->options); +                if (prev->dlhandle) +                        dlclose (prev->dlhandle); +                dict_unref (prev->options);                  GF_FREE (prev->name);                  GF_FREE (prev->type); +                xlator_list_destroy (prev->children); +                xlator_list_destroy (prev->parents); + +                list_for_each_entry_safe (vol_opt, tmp, &prev->volume_options, +                                          list) { +                        list_del_init (&vol_opt->list); +                        GF_FREE (vol_opt); +                }                  GF_FREE (prev);                  prev = trav;          } @@ -696,21 +722,6 @@ loc_is_root (loc_t *loc)  }  int -xlator_list_destroy (xlator_list_t *list) -{ -        xlator_list_t *next = NULL; - -        while (list) { -                next = list->next; -                GF_FREE (list); -                list = next; -        } - -        return 0; -} - - -int  xlator_destroy (xlator_t *xl)  {          volume_opt_list_t *vol_opt = NULL;  | 
