From 03aed04ac00e7985c7891a532d7c59a0a4c547ed Mon Sep 17 00:00:00 2001 From: Sanju Rakonde Date: Mon, 21 May 2018 16:18:53 +0530 Subject: glusterd: memory leak in geo-rep status Backport of: > BUG: 1580352 > Change-Id: I9648e73090f5a2edbac663a6fb49acdb702cdc49 > Signed-off-by: Sanju Rakonde fixes: bz#1611110 Change-Id: I9648e73090f5a2edbac663a6fb49acdb702cdc49 Signed-off-by: Sanju Rakonde --- xlators/mgmt/glusterd/src/glusterd-geo-rep.c | 8 ++++++-- 1 file 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; } -- cgit