diff options
author | Niels de Vos <ndevos@redhat.com> | 2015-03-15 14:16:56 +0100 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-03-15 16:12:35 -0700 |
commit | aaf7cd3c4059167b0f2ba821d14362a977f1d58c (patch) | |
tree | 9cf004f827ee33c1f7089c379016a2d53dfc880a /xlators/nfs/server | |
parent | b3f63120e8f2b6f99d44ebe244aafafeb6ac890e (diff) |
nfs: improve cleanup of 'struct exports_file' to prevent memory leak
BUG: 1143880
Change-Id: I359470a1edb935e206eeeecd4de7022530fb397a
Reported-by: Vijay Bellur <vbellur@redhat.com>
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/9882
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/nfs/server')
-rw-r--r-- | xlators/nfs/server/src/exports.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/xlators/nfs/server/src/exports.c b/xlators/nfs/server/src/exports.c index 3f704bdf9ce..793e020dd1f 100644 --- a/xlators/nfs/server/src/exports.c +++ b/xlators/nfs/server/src/exports.c @@ -91,11 +91,12 @@ _exports_file_init () goto free_and_out; } - - goto out; free_and_out: + if (file->exports_dict) + dict_unref (file->exports_dict); + GF_FREE (file); file = NULL; out: @@ -141,10 +142,21 @@ out: void exp_file_deinit (struct exports_file *expfile) { - if (!expfile || !expfile->exports_dict) + if (!expfile) goto out; - dict_foreach (expfile->exports_dict, _exp_file_dict_destroy, NULL); + if (expfile->exports_dict) { + dict_foreach (expfile->exports_dict, _exp_file_dict_destroy, + NULL); + dict_unref (expfile->exports_dict); + } + + if (expfile->exports_map) { + dict_foreach (expfile->exports_map, _exp_file_dict_destroy, + NULL); + dict_unref (expfile->exports_map); + } + GF_FREE (expfile->filename); GF_FREE (expfile); out: |