diff options
author | Susant Palai <spalai@redhat.com> | 2015-09-28 02:22:07 -0400 |
---|---|---|
committer | Raghavendra G <rgowdapp@redhat.com> | 2015-10-01 04:25:28 -0700 |
commit | 2b963bc22533cacbfc833cf64dd9bfef138db5ee (patch) | |
tree | 0da08844629234e9b1a5b9997a3b3e1408b5bd1f | |
parent | 801b7bd50a51c66e327ad79cdfc131654e069cdc (diff) |
dht/rebalance: fix mem-leak in migration code path
Change-Id: I37faf983fc02996541f3d96a17cb2a2c2cdb6781
BUG: 1266877
Signed-off-by: Susant Palai <spalai@redhat.com>
Reviewed-on: http://review.gluster.org/12235
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Tested-by: Raghavendra G <rgowdapp@redhat.com>
-rw-r--r-- | xlators/cluster/dht/src/dht-rebalance.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index ac73a090637..5b154f531b4 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -45,6 +45,22 @@ } \ void +gf_defrag_free_container (struct dht_container *container) +{ + if (container) { + gf_dirent_entry_free (container->df_entry); + + if (container->parent_loc) { + loc_wipe (container->parent_loc); + } + + GF_FREE (container->parent_loc); + + GF_FREE (container); + } +} + +void dht_set_global_defrag_error (gf_defrag_info_t *defrag, int ret) { LOCK (&defrag->lock); @@ -1929,8 +1945,8 @@ gf_defrag_task (void *opaque) goto out; } - gf_dirent_free (iterator->df_entry); - GF_FREE (iterator); + gf_defrag_free_container (iterator); + continue; } else { @@ -2212,13 +2228,13 @@ gf_defrag_get_entry (xlator_t *this, int i, struct dht_container **container, } out: + loc_wipe (&entry_loc); + if (ret == 0) { *container = tmp_container; } else { if (tmp_container) { - GF_FREE (tmp_container->df_entry); - GF_FREE (tmp_container->parent_loc); - GF_FREE (tmp_container); + gf_defrag_free_container (tmp_container); } } |