summaryrefslogtreecommitdiffstats
path: root/xlators/storage
diff options
context:
space:
mode:
authorvmallika <vmallika@redhat.com>2015-07-03 15:16:57 +0530
committerRaghavendra G <rgowdapp@redhat.com>2015-07-07 04:02:31 -0700
commit0c0e1d564f5a0f834169af6171d609a786cb3792 (patch)
tree101bbdcd0a8cc840c5f1cedbb3a0841a1c1b5917 /xlators/storage
parent74a143100fa4b9532d37bed39504dcea9d371d18 (diff)
posix: fix mem-leak in posix_get_ancestry error path
This is a backport of http://review.gluster.org/#/c/11522/ > Change-Id: I47c8a8f170151f6374fc0420278aedf3ff5443ee > BUG: 1207735 > Signed-off-by: vmallika <vmallika@redhat.com> Change-Id: I7863634ba7b3a2e8933d891df72cda7e129aa2a2 BUG: 1229282 Signed-off-by: vmallika <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/11528 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Tested-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/storage')
-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 19f537cf29c..46c69e6898f 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -3603,6 +3603,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;
@@ -3617,6 +3618,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);
@@ -3807,6 +3809,11 @@ posix_get_ancestry (xlator_t *this, inode_t *leaf_inode,
}
out:
+ if (ret && path && *path) {
+ GF_FREE (*path);
+ *path = NULL;
+ }
+
return ret;
}