diff options
-rw-r--r-- | xlators/performance/stat-prefetch/src/stat-prefetch.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c index b99c91bce..be83dcb29 100644 --- a/xlators/performance/stat-prefetch/src/stat-prefetch.c +++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c @@ -950,16 +950,22 @@ sp_get_ancestors (char *path, char **parent, char **grand_parent) switch (i) { case 0: - *parent = path; + *parent = gf_strdup (path); + if (*parent == NULL) + goto out; break; case 1: - *grand_parent = path; + *grand_parent = gf_strdup (path); + if (*grand_parent == NULL) + goto out; break; } } ret = 0; out: + if (cpy != NULL) + GF_FREE(cpy); return ret; } |