summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-transaction.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/cluster/afr/src/afr-transaction.c')
-rw-r--r--xlators/cluster/afr/src/afr-transaction.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index d48d6eb72f4..4afb7ce6f2a 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -308,24 +308,25 @@ afr_set_piggyback_dict (afr_private_t *priv, dict_t *xattr, int32_t **pending,
int ret = 0;
int *arr = NULL;
int index = 0;
+ size_t pending_xattr_size = 3 * sizeof (int32_t);
+ /* 3 = data+metadata+entry */
index = afr_index_for_transaction_type (type);
for (i = 0; i < priv->child_count; i++) {
- arr = GF_CALLOC (3 * sizeof (int32_t), priv->child_count,
+ arr = GF_CALLOC (1, pending_xattr_size,
gf_afr_mt_char);
if (!arr) {
ret = -1;
goto out;
}
- memcpy (arr, pending[i], 3 * sizeof (int32_t));
+ memcpy (arr, pending[i], pending_xattr_size);
arr[index]++;
ret = dict_set_bin (xattr, priv->pending_key[i],
- arr, 3 * sizeof (int32_t));
- /* 3 = data+metadata+entry */
+ arr, pending_xattr_size);
if (ret < 0)
goto out;