From 973a0528d4034f593a3f97d1373f259d32914c89 Mon Sep 17 00:00:00 2001
From: vmallika <vmallika@redhat.com>
Date: Fri, 3 Jul 2015 15:16:57 +0530
Subject: [PATCH 209/212] 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: Id85db72e16c76d33b988267389193cd286aabc06
BUG: 1224177
Signed-off-by: vmallika <vmallika@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/52304
Reviewed-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
Tested-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
---
xlators/storage/posix/src/posix.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index df90eb6..27c3457 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -3582,6 +3582,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;
@@ -3596,6 +3597,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);
@@ -3786,6 +3788,11 @@ posix_get_ancestry (xlator_t *this, inode_t *leaf_inode,
}
out:
+ if (ret && path && *path) {
+ GF_FREE (*path);
+ *path = NULL;
+ }
+
return ret;
}
--
1.7.1