summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/performance/stat-prefetch/src/stat-prefetch.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c
index 7f987dba2aa..f8b2bcd7951 100644
--- a/xlators/performance/stat-prefetch/src/stat-prefetch.c
+++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c
@@ -928,7 +928,7 @@ int32_t
sp_get_ancestors (char *path, char **parent, char **grand_parent)
{
int32_t ret = -1, i = 0;
- char *cpy = NULL;
+ char *cpy = NULL, *tmp = NULL;
if (!path || !parent || !grand_parent) {
ret = 0;
@@ -940,7 +940,14 @@ sp_get_ancestors (char *path, char **parent, char **grand_parent)
break;
}
+ tmp = cpy;
+
cpy = gf_strdup (path);
+
+ if (tmp != NULL) {
+ GF_FREE (tmp);
+ }
+
if (cpy == NULL) {
ret = -errno;
goto out;