summaryrefslogtreecommitdiffstats
path: root/xlators/features/quota/src/quota.c
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2014-09-08 21:52:30 +0530
committerRaghavendra G <rgowdapp@redhat.com>2014-09-09 03:12:15 -0700
commit7d0a305e23a28631c7c3e8cfc648c9c9a24148f6 (patch)
tree38d048175f8d1c1a2c63d65489f8cb086342d92f /xlators/features/quota/src/quota.c
parent822cf315a5d0f0d2bc90e9f2d8faa6e5e5701ed4 (diff)
quota/marker: Fix dict leaks
Unref dicts in quota and marker functions before they return. Change-Id: I772edc7b46657a70fb136e037576c65e9beeaca8 BUG: 1139327 Signed-off-by: Ravishankar N <ravishankar@redhat.com> Reviewed-on: http://review.gluster.org/8655 Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Tested-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/features/quota/src/quota.c')
-rw-r--r--xlators/features/quota/src/quota.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index afdade1432a..7b2e83189d4 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -562,7 +562,8 @@ quota_build_ancestry_open_cbk (call_frame_t *frame, void *cookie,
err:
fd_unref (fd);
- dict_unref (xdata_req);
+ if (xdata_req)
+ dict_unref (xdata_req);
if (op_ret < 0) {
local = frame->local;
@@ -2496,6 +2497,8 @@ dict_set:
ret = 0;
out:
+ if (dict)
+ dict_unref (dict);
return ret;
}
@@ -3534,7 +3537,6 @@ quota_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int64_t blocks = 0;
quota_inode_ctx_t *ctx = NULL;
int ret = 0;
- gf_boolean_t dict_created = _gf_false;
quota_local_t *local = frame->local;
inode = cookie;
@@ -3580,12 +3582,9 @@ quota_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
buf->f_bavail = buf->f_bfree;
}
- if (!xdata) {
- xdata = dict_new ();
- if (!xdata)
- goto unwind;
- dict_created = _gf_true;
- }
+ xdata = xdata ? dict_ref(xdata) : dict_new();
+ if (!xdata)
+ goto unwind;
ret = dict_set_int8 (xdata, "quota-deem-statfs", 1);
if (-1 == ret)
@@ -3595,7 +3594,7 @@ quota_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
unwind:
QUOTA_STACK_UNWIND (statfs, frame, op_ret, op_errno, buf, xdata);
- if (dict_created)
+ if (xdata)
dict_unref (xdata);
return 0;