summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshish Pandey <aspandey@redhat.com>2016-12-02 13:15:20 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2017-01-11 22:21:39 -0800
commit3f63362b6058d13dc51730d7b343fda0384e0091 (patch)
tree758280b247bacc8c3dd9bca250ef0fa284d12459
parent499efceee3b7899ba0bc833f386a303ec263211a (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> Change-Id: I49b83923e11aff9b92d002e86424c0c2e1f5f74f BUG: 1400833 Signed-off-by: Ashish Pandey <aspandey@redhat.com> Reviewed-on: http://review.gluster.org/16006 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Xavier Hernandez <xhernandez@datalab.es>
-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;