summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/ec/src/ec-inode-write.c
diff options
context:
space:
mode:
authorAshish Pandey <aspandey@redhat.com>2016-12-02 13:15:20 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-12-02 08:24:32 -0800
commit55ddf8c6b665d0b2ed024b984e871a68b25cffbf (patch)
treecd5ba0f4678d62db4867088dffcb3e88945a19ae /xlators/cluster/ec/src/ec-inode-write.c
parent99458974b7d12bd12d78d4b9a19adfb62d771b5c (diff)
cluster/ec: Check xdata to avoid memory leak
Problem: ec_writev_start calls ec_make_internal_fop_xdata to set "yes" in xdata before ec_readv (an internal fop) is called for head and tail. Second call to this function is overwriting the previous allocated dict_t to "xdata", which results in memory leak. Solution: In ec_make_internal_fop_xdata, check if *xdata is NULL or not to avoid overwriting *xdata. Change-Id: I49b83923e11aff9b92d002e86424c0c2e1f5f74f BUG: 1400818 Signed-off-by: Ashish Pandey <aspandey@redhat.com> Reviewed-on: http://review.gluster.org/16007 Reviewed-by: Xavier Hernandez <xhernandez@datalab.es> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/cluster/ec/src/ec-inode-write.c')
-rw-r--r--xlators/cluster/ec/src/ec-inode-write.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/xlators/cluster/ec/src/ec-inode-write.c b/xlators/cluster/ec/src/ec-inode-write.c
index 88145d98c83..744797bfcfe 100644
--- a/xlators/cluster/ec/src/ec-inode-write.c
+++ b/xlators/cluster/ec/src/ec-inode-write.c
@@ -1271,6 +1271,9 @@ ec_make_internal_fop_xdata (dict_t **xdata)
{
dict_t *dict = NULL;
+ if (*xdata)
+ return 0;
+
dict = dict_new();
if (!dict)
goto out;