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
This commit is contained in:
Pavan Sondur 2010-02-22 05:00:01 +00:00 committed by Anand V. Avati
parent bca308d50d
commit ec72771139

View File

@ -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);
}