From 26dc794e6586ca911678fc80e831e18cd99973fa Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Sat, 16 Apr 2011 09:45:49 +0000 Subject: marker: avoid memleak by unrefing dict, fd and local Signed-off-by: Raghavendra Bhat Signed-off-by: Anand Avati BUG: 2784 ([glusterfs-3.2.0qa13]: memleak in marker) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2784 --- xlators/features/marker/src/marker-quota-helper.c | 3 +++ xlators/features/marker/src/marker-quota.c | 7 +++++++ 2 files changed, 10 insertions(+) (limited to 'xlators/features') 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; } -- cgit