summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvmallika <vmallika@redhat.com>2015-07-03 15:16:57 +0530
committerRaghavendra G <rgowdapp@redhat.com>2015-07-06 09:18:23 -0700
commita95f5651b8e2159eedb2ab87e2253a233d3ecfe7 (patch)
tree1e97eb484df22ac6005c2d2191605159350608b3
parent5547db849770ff79a11a8bc1260478c56e4ffa9c (diff)
posix: fix mem-leak in posix_get_ancestry error path
Change-Id: I47c8a8f170151f6374fc0420278aedf3ff5443ee BUG: 1207735 Signed-off-by: vmallika <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/11522 Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-by: Sachin Pandit <spandit@redhat.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Tested-by: Raghavendra G <rgowdapp@redhat.com>
-rw-r--r--xlators/storage/posix/src/posix.c7
1 files changed, 7 insertions, 0 deletions
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;
}