summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanju Rakonde <srakonde@redhat.com>2018-05-21 16:18:53 +0530
committerAmar Tumballi <amarts@redhat.com>2018-05-28 02:43:21 +0000
commit1a2b33ac4e21fbe8658031fff8c92f5b4bb1e4af (patch)
tree75367423eea356529e14d48db563b6a20c2e1b1d
parent78fa818458ba75c12467768069c917d29b4422de (diff)
glusterd: memory leak in geo-rep status
Fixes: bz#1580352 Change-Id: I9648e73090f5a2edbac663a6fb49acdb702cdc49 Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-geo-rep.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
index 30e1bec96e4..fa40674510f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
+++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
@@ -513,8 +513,10 @@ glusterd_urltransform (runner_t *runner, char ***linearrp)
}
if (fgets (line, 1024, runner_chio (runner, STDOUT_FILENO)) ==
- NULL)
+ NULL) {
+ GF_FREE (line);
break;
+ }
len = strlen (line);
if (len == 0 || line[len - 1] != '\n') {
@@ -639,7 +641,7 @@ glusterd_get_slave (glusterd_volinfo_t *vol, const char *slaveurl, char **slavek
if (strcmp (linearr[i], linearr[n - 1]) == 0)
break;
}
- glusterd_urltransform_free (linearr, i);
+ glusterd_urltransform_free (linearr, n);
if (i < n - 1)
*slavekey = dict_get_by_index (vol->gsync_slaves, i);
@@ -5878,6 +5880,8 @@ glusterd_get_slave_info (char *slave,
}
out:
+ if (linearr)
+ glusterd_urltransform_free (linearr, 1);
gf_msg_debug (this->name, 0, "Returning %d", ret);
return ret;
}