|
|
887953 |
From 92b94a92d2ab3a0d392c0ba6c412bc20144de956 Mon Sep 17 00:00:00 2001
|
|
|
887953 |
From: Mohit Agrawal <moagrawa@redhat.com>
|
|
|
887953 |
Date: Tue, 20 Nov 2018 18:35:58 +0530
|
|
|
887953 |
Subject: [PATCH 450/450] glusterd: fix Resource leak coverity issue
|
|
|
887953 |
|
|
|
887953 |
Problem: In commit bcf1e8b07491b48c5372924dbbbad5b8391c6d81 code
|
|
|
887953 |
was missed to free path return by function search_brick_path_from_proc
|
|
|
887953 |
|
|
|
887953 |
> This patch fixes CID:
|
|
|
887953 |
> 1396668: Resource leak
|
|
|
887953 |
> (Cherry pick from commit 818e60ac9269c49396480a151c049042af5b2929)
|
|
|
887953 |
> (Reviewed on link https://review.gluster.org/#/c/glusterfs/+/21630/)
|
|
|
887953 |
|
|
|
887953 |
> Change-Id: I4888c071c1058023c7e138a8bcb94ec97305fadf
|
|
|
887953 |
> fixes: bz#1646892
|
|
|
887953 |
|
|
|
887953 |
Change-Id: I9b0a9f4257b74e65c9f8c8686a6b124445f64d64
|
|
|
887953 |
BUG: 1649651
|
|
|
887953 |
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
|
|
|
887953 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/156334
|
|
|
887953 |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
887953 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
887953 |
---
|
|
|
887953 |
xlators/mgmt/glusterd/src/glusterd-handler.c | 11 +++++++++--
|
|
|
887953 |
1 file changed, 9 insertions(+), 2 deletions(-)
|
|
|
887953 |
|
|
|
887953 |
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
887953 |
index cab0dec..7486f51 100644
|
|
|
887953 |
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
887953 |
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
887953 |
@@ -6060,6 +6060,7 @@ __glusterd_brick_rpc_notify (struct rpc_clnt *rpc, void *mydata,
|
|
|
887953 |
glusterd_brickinfo_t *brickinfo_tmp = NULL;
|
|
|
887953 |
glusterd_brick_proc_t *brick_proc = NULL;
|
|
|
887953 |
char pidfile[PATH_MAX] = {0};
|
|
|
887953 |
+ char *brickpath = NULL;
|
|
|
887953 |
|
|
|
887953 |
brickid = mydata;
|
|
|
887953 |
if (!brickid)
|
|
|
887953 |
@@ -6167,8 +6168,11 @@ __glusterd_brick_rpc_notify (struct rpc_clnt *rpc, void *mydata,
|
|
|
887953 |
*/
|
|
|
887953 |
GLUSTERD_GET_BRICK_PIDFILE (pidfile, volinfo,
|
|
|
887953 |
brickinfo, conf);
|
|
|
887953 |
- if (!gf_is_service_running (pidfile, &pid) ||
|
|
|
887953 |
- !search_brick_path_from_proc(pid, brickinfo->path)) {
|
|
|
887953 |
+ gf_is_service_running(pidfile, &pid;;
|
|
|
887953 |
+ if (pid > 0)
|
|
|
887953 |
+ brickpath = search_brick_path_from_proc(pid,
|
|
|
887953 |
+ brickinfo->path);
|
|
|
887953 |
+ if (!gf_is_service_running (pidfile, &pid) || !brickpath) {
|
|
|
887953 |
ret = pmap_registry_remove (
|
|
|
887953 |
THIS, brickinfo->port,
|
|
|
887953 |
brickinfo->path,
|
|
|
887953 |
@@ -6186,6 +6190,9 @@ __glusterd_brick_rpc_notify (struct rpc_clnt *rpc, void *mydata,
|
|
|
887953 |
}
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
+ if (brickpath)
|
|
|
887953 |
+ GF_FREE (brickpath);
|
|
|
887953 |
+
|
|
|
887953 |
if (is_brick_mx_enabled() && glusterd_is_brick_started(brickinfo)) {
|
|
|
887953 |
brick_proc = brickinfo->brick_proc;
|
|
|
887953 |
if (!brick_proc)
|
|
|
887953 |
--
|
|
|
887953 |
1.8.3.1
|
|
|
887953 |
|