From a95f5651b8e2159eedb2ab87e2253a233d3ecfe7 Mon Sep 17 00:00:00 2001 From: vmallika Date: Fri, 3 Jul 2015 15:16:57 +0530 Subject: posix: fix mem-leak in posix_get_ancestry error path Change-Id: I47c8a8f170151f6374fc0420278aedf3ff5443ee BUG: 1207735 Signed-off-by: vmallika Reviewed-on: http://review.gluster.org/11522 Reviewed-by: Krishnan Parthasarathi Reviewed-by: Sachin Pandit Reviewed-by: Raghavendra G Tested-by: Raghavendra G --- xlators/storage/posix/src/posix.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'xlators') diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 36d2c857835..c89ef7d92ad 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -3598,6 +3598,7 @@ posix_links_in_same_directory (char *dirpath, int count, inode_t *leaf_inode, + strlen (temppath) + 1 ); if (!tempv) { GF_FREE (*path); + *path = NULL; op_ret = -1; *op_errno = ENOMEM; goto out; @@ -3612,6 +3613,7 @@ posix_links_in_same_directory (char *dirpath, int count, inode_t *leaf_inode, count--; } + op_ret = 0; out: if (dirp) { op_ret = closedir (dirp); @@ -3802,6 +3804,11 @@ posix_get_ancestry (xlator_t *this, inode_t *leaf_inode, } out: + if (ret && path && *path) { + GF_FREE (*path); + *path = NULL; + } + return ret; } -- cgit