summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendrabhat@gluster.com>2011-04-16 09:45:49 +0000
committerAnand Avati <avati@gluster.com>2011-04-16 10:51:48 -0700
commit26dc794e6586ca911678fc80e831e18cd99973fa (patch)
tree35cf1781c15e94869c39d1b2a36c61f3f68d8d13
parent3e873600920a180960e6730a531ba7a5912f5543 (diff)
marker: avoid memleak by unrefing dict, fd and local
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2784 ([glusterfs-3.2.0qa13]: memleak in marker) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2784
-rw-r--r--xlators/features/marker/src/marker-quota-helper.c3
-rw-r--r--xlators/features/marker/src/marker-quota.c7
2 files changed, 10 insertions, 0 deletions
diff --git a/xlators/features/marker/src/marker-quota-helper.c b/xlators/features/marker/src/marker-quota-helper.c
index d7afd40a6..fba2cdd3f 100644
--- a/xlators/features/marker/src/marker-quota-helper.c
+++ b/xlators/features/marker/src/marker-quota-helper.c
@@ -362,6 +362,9 @@ quota_local_unref (xlator_t *this, quota_local_t *local)
if (local->ref > 0)
goto out;
+ if (local->fd != NULL)
+ fd_unref (local->fd);
+
loc_wipe (&local->loc);
loc_wipe (&local->parent_loc);
diff --git a/xlators/features/marker/src/marker-quota.c b/xlators/features/marker/src/marker-quota.c
index 9a7bf868d..b07a7d13e 100644
--- a/xlators/features/marker/src/marker-quota.c
+++ b/xlators/features/marker/src/marker-quota.c
@@ -1791,11 +1791,14 @@ mq_reduce_parent_size_xattr (call_frame_t *frame, void *cookie,
STACK_WIND (frame, mq_inode_remove_done, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->xattrop, &local->parent_loc,
GF_XATTROP_ADD_ARRAY64, dict);
+ dict_unref (dict);
return 0;
err:
local->err = 1;
mq_inode_remove_done (frame, NULL, this, -1, 0, NULL);
+ if (dict)
+ dict_unref (dict);
return 0;
}
@@ -1862,6 +1865,10 @@ reduce_parent_size (xlator_t *this, loc_t *loc)
ret = 0;
out:
+ if (ret < 0) {
+ quota_local_unref (this, local);
+ GF_FREE (local);
+ }
return ret;
}