summaryrefslogtreecommitdiffstats
path: root/xlators/performance/stat-prefetch
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2011-08-23 12:32:36 +0530
committerVijay Bellur <vijay@gluster.com>2011-08-23 01:59:24 -0700
commit6e02c879ad847b760a05f9afd3fddc9f152bda23 (patch)
tree28555dadadf6e3a05d13e7e9d84730c598fe2c50 /xlators/performance/stat-prefetch
parentdd996d529d155143e3ad49dc3b30461d9eb3ff43 (diff)
performance/stat-prefetch: fix memory leak
Change-Id: I84580e297ba93a9a093c2e3432ea52e3c0db4a1a BUG: 3467 Reviewed-on: http://review.gluster.com/307 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/performance/stat-prefetch')
-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 7f987dba2..f8b2bcd79 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;