diff options
author | Pavan Sondur <pavan@gluster.com> | 2010-02-22 05:39:14 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-02-22 03:40:12 -0800 |
commit | 516fe5fce04673f3040172c8b3bcfa5c00658a3f (patch) | |
tree | c148ea7c2c484d8ebc547dae25f2d06b980ee6f1 /xlators | |
parent | 53f7786f307f0d2044ea427daeb3587563877f71 (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')
-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); } |