9ae3f9
From 7e1bf1e338a6effe209f57b1b92a70d5d25a73bf Mon Sep 17 00:00:00 2001
9ae3f9
From: Jiffin Tony Thottan <jthottan@redhat.com>
9ae3f9
Date: Mon, 26 Aug 2019 11:32:18 +0530
9ae3f9
Subject: [PATCH 428/449] glusterd/ganesha: fixing resource leak in
9ae3f9
 tear_down_cluster()
9ae3f9
9ae3f9
backport of https://review.gluster.org/#/c/glusterfs/+/23295/
9ae3f9
>CID: 1370947
9ae3f9
>Updates: bz#789278
9ae3f9
>Change-Id: Ib694056430ff0536ed705a0e77e5ace22486891e
9ae3f9
>Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
9ae3f9
9ae3f9
BUG: 1787310
9ae3f9
Change-Id: Ib694056430ff0536ed705a0e77e5ace22486891e
9ae3f9
Signed-off-by: Barak Sason Rofman <bsasonro@redhat.com>
9ae3f9
Reviewed-on: https://code.engineering.redhat.com/gerrit/202561
9ae3f9
Tested-by: RHGS Build Bot <nigelb@redhat.com>
9ae3f9
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
9ae3f9
---
9ae3f9
 xlators/mgmt/glusterd/src/glusterd-ganesha.c | 8 ++++++++
9ae3f9
 1 file changed, 8 insertions(+)
9ae3f9
9ae3f9
diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
9ae3f9
index 0a16925..06f028f 100644
9ae3f9
--- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c
9ae3f9
+++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
9ae3f9
@@ -659,10 +659,18 @@ tear_down_cluster(gf_boolean_t run_teardown)
9ae3f9
                          "Failed to close dir %s. Reason :"
9ae3f9
                          " %s",
9ae3f9
                          CONFDIR, strerror(errno));
9ae3f9
+            goto exit;
9ae3f9
         }
9ae3f9
     }
9ae3f9
 
9ae3f9
 out:
9ae3f9
+    if (dir && sys_closedir(dir)) {
9ae3f9
+        gf_msg_debug(THIS->name, 0,
9ae3f9
+                     "Failed to close dir %s. Reason :"
9ae3f9
+                     " %s",
9ae3f9
+                     CONFDIR, strerror(errno));
9ae3f9
+    }
9ae3f9
+exit:
9ae3f9
     return ret;
9ae3f9
 }
9ae3f9
 
9ae3f9
-- 
9ae3f9
1.8.3.1
9ae3f9