summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanju Rakonde <srakonde@redhat.com>2018-05-21 16:18:53 +0530
committerKotresh HR <khiremat@redhat.com>2018-08-16 00:20:32 -0400
commit03aed04ac00e7985c7891a532d7c59a0a4c547ed (patch)
tree4d472032b6bd4f51f5c757be9207f860e787701f
parent396277b9a24b5f7793b3b0f91e7aa7992e8a145e (diff)
glusterd: memory leak in geo-rep status
Backport of: > BUG: 1580352 > Change-Id: I9648e73090f5a2edbac663a6fb49acdb702cdc49 > Signed-off-by: Sanju Rakonde <srakonde@redhat.com> fixes: bz#1611110 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;
}