summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2014-08-11 20:22:53 +0530
committerAnand Avati <avati@redhat.com>2014-08-11 22:22:26 -0700
commita66a483be2febd36e6cb338c9fe73d332257d89e (patch)
treea0d0fa72e6efc9e054a6c53bd33bfd41cdf63474
parentc77a77ef0fca8371bba956b78a2da80f73f6f26b (diff)
cluster/afr: Fix mem-leak
Problem: local->xattr_req is already reffed with xattr_req that comes in lookup fop. But when afr_lookup_xattr_req_prepare is called local->xattr_req is over-written with dict_new() which leads to ref leak on the dict which came in lookup fop Fix: Create local->xattr_req only when it is NULL Change-Id: Ib1548f2df97688859f2cace44b93b3b733297c36 BUG: 1128801 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/8457 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r--xlators/cluster/afr/src/afr-common.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 04191649b4c..8fc202512f1 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -679,10 +679,13 @@ afr_lookup_xattr_req_prepare (afr_local_t *local, xlator_t *this,
{
int ret = -ENOMEM;
- local->xattr_req = dict_new ();
+ if (!local->xattr_req)
+ local->xattr_req = dict_new ();
+
if (!local->xattr_req)
goto out;
- if (xattr_req)
+
+ if (xattr_req != local->xattr_req)
dict_copy (xattr_req, local->xattr_req);
ret = afr_xattr_req_prepare (this, local->xattr_req);