summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-common.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2018-02-28 17:58:31 +0530
committerPranith Kumar K <pkarampu@redhat.com>2018-02-28 18:53:59 +0530
commite7b79c59590c203c65f7ac8548b30d068c232d33 (patch)
tree8831e942399bd33da6cbff53a7e21c9b1fb6202a /xlators/cluster/afr/src/afr-common.c
parente2766c32631d27519e688ebec48c408b36e3cc79 (diff)
cluster/afr: Fix dict-leak in pre-op
At the time of pre-op, pre_op_xdata is populted with the xattrs we get from the disk and at the time of post-op it gets over-written without unreffing the previous value stored leading to a leak. This is a regression we missed in https://review.gluster.org/#/q/ba149bac92d169ae2256dbc75202dc9e5d06538e BUG: 1550078 Change-Id: I0456f9ad6f77ce6248b747964a037193af3a3da7 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-common.c')
-rw-r--r--xlators/cluster/afr/src/afr-common.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 96419c6..ea3df12 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -1033,7 +1033,7 @@ afr_readables_fill (call_frame_t *frame, xlator_t *this, inode_t *inode,
xdata = replies[i].xdata;
ia_type = replies[i].poststat.ia_type;
} else {/* pre-op xattrop */
- xdata = local->transaction.pre_op_xdata[i];
+ xdata = local->transaction.changelog_xdata[i];
ia_type = inode->ia_type;
}
@@ -1764,13 +1764,13 @@ afr_local_transaction_cleanup (afr_local_t *local, xlator_t *this)
GF_FREE (local->transaction.pre_op);
GF_FREE (local->transaction.pre_op_sources);
- if (local->transaction.pre_op_xdata) {
+ if (local->transaction.changelog_xdata) {
for (i = 0; i < priv->child_count; i++) {
- if (!local->transaction.pre_op_xdata[i])
+ if (!local->transaction.changelog_xdata[i])
continue;
- dict_unref (local->transaction.pre_op_xdata[i]);
+ dict_unref (local->transaction.changelog_xdata[i]);
}
- GF_FREE (local->transaction.pre_op_xdata);
+ GF_FREE (local->transaction.changelog_xdata);
}
GF_FREE (local->transaction.eager_lock);
@@ -5603,10 +5603,10 @@ afr_transaction_local_init (afr_local_t *local, xlator_t *this)
if (!local->transaction.pre_op)
goto out;
- local->transaction.pre_op_xdata =
- GF_CALLOC (sizeof (*local->transaction.pre_op_xdata),
+ local->transaction.changelog_xdata =
+ GF_CALLOC (sizeof (*local->transaction.changelog_xdata),
priv->child_count, gf_afr_mt_dict_t);
- if (!local->transaction.pre_op_xdata)
+ if (!local->transaction.changelog_xdata)
goto out;
if (priv->arbiter_count == 1) {