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>
This commit is contained in:
parent
c77a77ef0f
commit
a66a483be2
@ -679,10 +679,13 @@ afr_lookup_xattr_req_prepare (afr_local_t *local, xlator_t *this,
|
|||||||
{
|
{
|
||||||
int ret = -ENOMEM;
|
int ret = -ENOMEM;
|
||||||
|
|
||||||
local->xattr_req = dict_new ();
|
if (!local->xattr_req)
|
||||||
|
local->xattr_req = dict_new ();
|
||||||
|
|
||||||
if (!local->xattr_req)
|
if (!local->xattr_req)
|
||||||
goto out;
|
goto out;
|
||||||
if (xattr_req)
|
|
||||||
|
if (xattr_req != local->xattr_req)
|
||||||
dict_copy (xattr_req, local->xattr_req);
|
dict_copy (xattr_req, local->xattr_req);
|
||||||
|
|
||||||
ret = afr_xattr_req_prepare (this, local->xattr_req);
|
ret = afr_xattr_req_prepare (this, local->xattr_req);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user