diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2014-08-11 20:22:53 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-08-19 23:38:50 -0700 |
commit | e8105af16c58f8c01be9b7d58b414da4391c86d6 (patch) | |
tree | d7006c5801b35d4bae3c516b5e4c5041da48223f /xlators/cluster | |
parent | a42ea55a0062ea7c39a9e0390f13e8cb16a914aa (diff) |
cluster/afr: Fix mem-leak
Backport of http://review.gluster.org/8457
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
BUG: 1128801
Change-Id: I4a1065add7700317e0cd3d0dda0a91e12d77e340
Reviewed-on: http://review.gluster.org/8460
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 7 |
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 e4fbe794f08..13dd81e25fe 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); |