summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2016-09-21 15:30:55 +0200
committerDaiki Ueno <ueno@gnu.org>2016-10-31 12:59:17 +0100
commitae0527969dbb2dea5bf97257c92a65b72ba71db5 (patch)
treec770e91e315d20e2008735c7bd67067f811c6123
parent7e94bcac88e16c22b8258bcdcb4b2165b198679a (diff)
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
-rw-r--r--p11-kit/modules.c2
1 files changed, 2 insertions, 0 deletions
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);