From ae0527969dbb2dea5bf97257c92a65b72ba71db5 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Wed, 21 Sep 2016 15:30:55 +0200 Subject: modules: Fix memleak when loading remote module Make sure to call p11_virtual_uninit() on managed module. Otherwise the associated lower_module will not be released. GCC's asan spotted this: Direct leak of 56 byte(s) in 1 object(s) allocated from: #0 0x7f6c5368dfe0 in calloc (/lib64/libasan.so.3+0xc6fe0) #1 0x4436ba in p11_rpc_client_init ../p11-kit/rpc-client.c:2082 #2 0x42c147 in p11_rpc_transport_new ../p11-kit/rpc-transport.c:850 #3 0x415d95 in setup_module_for_remote_inlock ../p11-kit/modules.c:411 --- p11-kit/modules.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'p11-kit') diff --git a/p11-kit/modules.c b/p11-kit/modules.c index 6e15c1d..4af2a83 100644 --- a/p11-kit/modules.c +++ b/p11-kit/modules.c @@ -251,6 +251,8 @@ free_module_unlocked (void *data) assert (mod->initialize_thread == 0); } + p11_virtual_uninit (&mod->virt); + if (mod->loaded_destroy) mod->loaded_destroy (mod->loaded_module); -- cgit v1.1