diff options
author | Niels de Vos <ndevos@redhat.com> | 2017-05-12 13:12:39 +0200 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2017-05-16 00:29:12 +0000 |
commit | 9a20120790a462608a6121504bab27e4e910b471 (patch) | |
tree | e285727f242c4a84a3de5848d9432fb365145914 | |
parent | 56fe5a6559a594cc9b02a9fe5eb2b0a22e9da1a9 (diff) |
nl-cache: free nlc_conf_t in fini()
The (xlator_t*)->private structure in negative-lookup-cache is allocated
in the init() function of the xlator, but never free'd. Valgrind
detected this as:
656 bytes in 1 blocks are definitely lost in loss record X of Y
at 0x..+ calloc (/builddir/build/BUILD/valgrind-3.11.0/coregrind/m_replacemalloc/vg_replace_malloc.c:711)
by 0x.. __gf_calloc (/usr/src/debug/glusterfs-3.11dev/libglusterfs/src/mem-pool.c:117)
by 0x.. init (/usr/src/debug/glusterfs-3.11dev/xlators/performance/nl-cache/src/nl-cache.c:669)
by 0x.. __xlator_init (/usr/src/debug/glusterfs-3.11dev/libglusterfs/src/xlator.c:472)
by 0x.. xlator_init (/usr/src/debug/glusterfs-3.11dev/libglusterfs/src/xlator.c:498)
by 0x.. glusterfs_graph_init (/usr/src/debug/glusterfs-3.11dev/libglusterfs/src/graph.c:321)
by 0x.. glusterfs_graph_activate (/usr/src/debug/glusterfs-3.11dev/libglusterfs/src/graph.c:693)
by 0x.. glfs_process_volfp (/usr/src/debug/glusterfs-3.11dev/api/src/glfs-mgmt.c:79)
by 0x.. glfs_volumes_init (/usr/src/debug/glusterfs-3.11dev/api/src/glfs.c:160)
by 0x.. glfs_init_common (/usr/src/debug/glusterfs-3.11dev/api/src/glfs.c:868)
by 0x.. glfs_init@@GFAPI_3.4.0 (/usr/src/debug/glusterfs-3.11dev/api/src/glfs.c:913)
by 0x.. main (/root/gluster-debug/gfapi-load-volfile/gfapi-load-volfile.c:54)
When the xlators is unloaded, it should free the resources it allocated.
This can easily be done in the fini() function.
Cherry picked from commit d7e9dcfad228f385ad64526b1f06b55e98b06964:
> Change-Id: I079e78cc207145bc542e2282fc4cf2bb4dadc28a
> BUG: 1442569
> Signed-off-by: Niels de Vos <ndevos@redhat.com>
> Reviewed-on: https://review.gluster.org/17143
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
Change-Id: I079e78cc207145bc542e2282fc4cf2bb4dadc28a
BUG: 1450267
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: https://review.gluster.org/17263
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Zhou Zhengping <johnzzpcrystal@gmail.com>
Reviewed-by: Poornima G <pgurusid@redhat.com>
-rw-r--r-- | xlators/performance/nl-cache/src/nl-cache.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/xlators/performance/nl-cache/src/nl-cache.c b/xlators/performance/nl-cache/src/nl-cache.c index f8d2642be30..675b5de24bf 100644 --- a/xlators/performance/nl-cache/src/nl-cache.c +++ b/xlators/performance/nl-cache/src/nl-cache.c @@ -626,6 +626,11 @@ nlc_priv_dump (xlator_t *this) void fini (xlator_t *this) { + nlc_conf_t *conf = NULL; + + conf = this->private; + GF_FREE (conf); + glusterfs_ctx_tw_put (this->ctx); return; |