From 46c15ea8fa98bb3d92580b192f03863c2e2a2d9c Mon Sep 17 00:00:00 2001 From: Mohit Agrawal Date: Thu, 29 Nov 2018 19:55:39 +0530 Subject: server: Resolve memory leak path in server_init Problem: 1) server_init does not cleanup allocate resources while it is failed before return error 2) dict leak at the time of graph destroying Solution: 1) free resources in case of server_init is failed 2) Take dict_ref of graph xlator before destroying the graph to avoid leak Change-Id: I9e31e156b9ed6bebe622745a8be0e470774e3d15 fixes: bz#1654917 Signed-off-by: Mohit Agrawal --- glusterfsd/src/glusterfsd.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'glusterfsd') diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index 771af423ea..5bf0db0edf 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -2618,6 +2618,10 @@ out: xl = graph->first; if ((ctx->active != graph) && (xl && !strcmp(xl->type, "protocol/server"))) { + /* Take dict ref for every graph xlator to avoid dict leak + at the time of graph destroying + */ + gluster_graph_take_reference(graph->first); glusterfs_graph_fini(graph); glusterfs_graph_destroy(graph); } -- cgit