summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohit Agrawal <moagrawal@redhat.com>2018-11-16 09:25:02 +0530
committerAmar Tumballi <amarts@redhat.com>2018-11-20 09:37:50 +0000
commit751b14f2bfd40e08ad395ccd98c6eb0a41ac4e91 (patch)
tree75bdb0424e0d6a982bb72789f763ecd662325db5
parentfbfceb9f2ee240737b329de8aa5b13562f99fddb (diff)
core: Resolve memory leak at the time of graph init
Problem: Memory leak when graph init fails as during volfile exchange between brick and glusterd Solution: Fix the error code path in glusterfs_graph_init Change-Id: If62bee61283fccb7fd60abc6ea217cfac12358fa fixes: bz#1651431 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
-rw-r--r--glusterfsd/src/glusterfsd.c11
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c4
2 files changed, 7 insertions, 8 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index f9f263aae66..106bfe3bcc1 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -2583,11 +2583,14 @@ out:
if (fp)
fclose(fp);
- if (ret && !ctx->active) {
- glusterfs_graph_destroy(graph);
+ if (ret) {
+ if (graph && (ctx && (ctx->active != graph)))
+ glusterfs_graph_destroy(graph);
/* there is some error in setting up the first graph itself */
- emancipate(ctx, ret);
- cleanup_and_exit(ret);
+ if (!ctx->active) {
+ emancipate(ctx, ret);
+ cleanup_and_exit(ret);
+ }
}
return ret;
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index e79d2813655..b1fa6247ee1 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -1115,10 +1115,6 @@ glusterd_init_uds_listener(xlator_t *this)
(void)snprintf(sockfile, sizeof(sockfile), "%s",
sock_data ? sock_data->data : DEFAULT_GLUSTERD_SOCKFILE);
- options = dict_new();
- if (!options)
- goto out;
-
ret = rpcsvc_transport_unix_options_build(&options, sockfile);
if (ret)
goto out;