diff options
author | Pavan Sondur <pavan@gluster.com> | 2010-02-22 05:00:01 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-02-22 02:56:51 -0800 |
commit | ec7277113956520fa6637c94d60d13d398617225 (patch) | |
tree | bd4f22c934d65570e9510b66e67d7bd2fec11484 /xlators/features/quota/src | |
parent | bca308d50d90559b33fe7e1e6ee18b8f194552f3 (diff) |
features/quota: Fix memory leak while syncing disk usage.
Signed-off-by: Pavan Vilas Sondur <pavan@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 569 (Memory leak in quota translator)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=569
Diffstat (limited to 'xlators/features/quota/src')
-rw-r--r-- | xlators/features/quota/src/quota.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index 3d75f6add..41d8b24f9 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -797,12 +797,19 @@ int quota_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno) { + dict_t *dict = NULL; + if (op_ret == -1) { gf_log (this->name, GF_LOG_CRITICAL, "failed to set the disk-usage value: %s", strerror (op_errno)); } + if (cookie) { + dict = (dict_t *) cookie; + dict_unref (dict); + } + STACK_DESTROY (frame->root); return 0; } @@ -914,10 +921,13 @@ gf_quota_cache_sync (xlator_t *this) dict_set (dict, "trusted.glusterfs-quota-du", data_from_uint64 (priv->current_disk_usage)); - STACK_WIND (frame, quota_setxattr_cbk, - this->children->xlator, - this->children->xlator->fops->setxattr, - &loc, dict, 0); + dict_ref (dict); + + STACK_WIND_COOKIE (frame, quota_setxattr_cbk, + (void *) (dict_t *) dict, + this->children->xlator, + this->children->xlator->fops->setxattr, + &loc, dict, 0); } |