From 55ddf8c6b665d0b2ed024b984e871a68b25cffbf Mon Sep 17 00:00:00 2001 From: Ashish Pandey Date: Fri, 2 Dec 2016 13:15:20 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/16007 Reviewed-by: Xavier Hernandez Reviewed-by: Pranith Kumar Karampuri Tested-by: Pranith Kumar Karampuri Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- xlators/cluster/ec/src/ec-inode-write.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'xlators/cluster/ec/src/ec-inode-write.c') 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; -- cgit