summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-common.c
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2011-11-13 11:56:46 +0530
committerVijay Bellur <vijay@gluster.com>2011-11-23 03:11:20 -0800
commit829f2b90fba8f66287e2e3b89aed9c971c2d828b (patch)
tree9d378c333d5c21f965f36b700ead0d2d25e69804 /xlators/cluster/afr/src/afr-common.c
parentc9fbd4c309552f7f845e73c92315abe3b6d7081b (diff)
cluster/afr: Fix memory leaks
Change-Id: I79a1c70c47649fbcf236191f174d766d5806545c BUG: 3805 Reviewed-on: http://review.gluster.com/719 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-common.c')
-rw-r--r--xlators/cluster/afr/src/afr-common.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 9ab321eb..108b021b 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -1057,7 +1057,8 @@ afr_lookup_build_response_params (afr_local_t *local, xlator_t *this)
}
gf_log (this->name, GF_LOG_DEBUG, "Building lookup response from %d",
read_child);
- *xattr = dict_ref (local->cont.lookup.xattrs[read_child]);
+ if (!*xattr)
+ *xattr = dict_ref (local->cont.lookup.xattrs[read_child]);
*buf = local->cont.lookup.bufs[read_child];
*postparent = local->cont.lookup.postparents[read_child];
@@ -1920,6 +1921,7 @@ afr_lookup_cont_init (afr_local_t *local, unsigned int child_count)
int ret = -ENOMEM;
struct iatt *iatts = NULL;
int32_t *success_children = NULL;
+ int32_t *sources = NULL;
GF_ASSERT (local);
local->cont.lookup.xattrs = GF_CALLOC (child_count,
@@ -1947,6 +1949,11 @@ afr_lookup_cont_init (afr_local_t *local, unsigned int child_count)
if (NULL == local->fresh_children)
goto out;
+ sources = GF_CALLOC (sizeof (*sources), child_count, gf_afr_mt_int32_t);
+ if (NULL == sources)
+ goto out;
+ local->cont.lookup.sources = sources;
+
ret = 0;
out:
return ret;