21ab4e
From 89379c77dbb92f6f51bb18a87ff4274ba71c4ebd Mon Sep 17 00:00:00 2001
21ab4e
From: Niels de Vos <ndevos@redhat.com>
21ab4e
Date: Fri, 12 May 2017 13:12:39 +0200
21ab4e
Subject: [PATCH 435/473] nl-cache: free nlc_conf_t in fini()
21ab4e
21ab4e
The (xlator_t*)->private structure in negative-lookup-cache is allocated
21ab4e
in the init() function of the xlator, but never free'd. Valgrind
21ab4e
detected this as:
21ab4e
21ab4e
    656 bytes in 1 blocks are definitely lost in loss record X of Y
21ab4e
       at 0x..+ calloc (/builddir/build/BUILD/valgrind-3.11.0/coregrind/m_replacemalloc/vg_replace_malloc.c:711)
21ab4e
       by 0x.. __gf_calloc (/usr/src/debug/glusterfs-3.11dev/libglusterfs/src/mem-pool.c:117)
21ab4e
       by 0x.. init (/usr/src/debug/glusterfs-3.11dev/xlators/performance/nl-cache/src/nl-cache.c:669)
21ab4e
       by 0x.. __xlator_init (/usr/src/debug/glusterfs-3.11dev/libglusterfs/src/xlator.c:472)
21ab4e
       by 0x.. xlator_init (/usr/src/debug/glusterfs-3.11dev/libglusterfs/src/xlator.c:498)
21ab4e
       by 0x.. glusterfs_graph_init (/usr/src/debug/glusterfs-3.11dev/libglusterfs/src/graph.c:321)
21ab4e
       by 0x.. glusterfs_graph_activate (/usr/src/debug/glusterfs-3.11dev/libglusterfs/src/graph.c:693)
21ab4e
       by 0x.. glfs_process_volfp (/usr/src/debug/glusterfs-3.11dev/api/src/glfs-mgmt.c:79)
21ab4e
       by 0x.. glfs_volumes_init (/usr/src/debug/glusterfs-3.11dev/api/src/glfs.c:160)
21ab4e
       by 0x.. glfs_init_common (/usr/src/debug/glusterfs-3.11dev/api/src/glfs.c:868)
21ab4e
       by 0x.. glfs_init@@GFAPI_3.4.0 (/usr/src/debug/glusterfs-3.11dev/api/src/glfs.c:913)
21ab4e
       by 0x.. main (/root/gluster-debug/gfapi-load-volfile/gfapi-load-volfile.c:54)
21ab4e
21ab4e
When the xlators is unloaded, it should free the resources it allocated.
21ab4e
This can easily be done in the fini() function.
21ab4e
21ab4e
Cherry picked from commit d7e9dcfad228f385ad64526b1f06b55e98b06964:
21ab4e
> Change-Id: I079e78cc207145bc542e2282fc4cf2bb4dadc28a
21ab4e
> BUG: 1442569
21ab4e
> Signed-off-by: Niels de Vos <ndevos@redhat.com>
21ab4e
> Reviewed-on: https://review.gluster.org/17143
21ab4e
> Smoke: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
21ab4e
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
21ab4e
21ab4e
Change-Id: I079e78cc207145bc542e2282fc4cf2bb4dadc28a
21ab4e
BUG: 1450336
21ab4e
Signed-off-by: Poornima G <pgurusid@redhat.com>
21ab4e
Reviewed-on: https://code.engineering.redhat.com/gerrit/106134
21ab4e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
21ab4e
---
21ab4e
 xlators/performance/nl-cache/src/nl-cache.c | 5 +++++
21ab4e
 1 file changed, 5 insertions(+)
21ab4e
21ab4e
diff --git a/xlators/performance/nl-cache/src/nl-cache.c b/xlators/performance/nl-cache/src/nl-cache.c
21ab4e
index 92dbccb..08e7d9e 100644
21ab4e
--- a/xlators/performance/nl-cache/src/nl-cache.c
21ab4e
+++ b/xlators/performance/nl-cache/src/nl-cache.c
21ab4e
@@ -624,6 +624,11 @@ nlc_priv_dump (xlator_t *this)
21ab4e
 void
21ab4e
 fini (xlator_t *this)
21ab4e
 {
21ab4e
+        nlc_conf_t      *conf       = NULL;
21ab4e
+
21ab4e
+        conf = this->private;
21ab4e
+        GF_FREE (conf);
21ab4e
+
21ab4e
         glusterfs_ctx_tw_put (this->ctx);
21ab4e
 
21ab4e
         return;
21ab4e
-- 
21ab4e
1.8.3.1
21ab4e