Skip to content

Commit

Permalink
modules: Fix memleak when loading remote module
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ueno committed Oct 31, 2016
1 parent 7e94bca commit ae05279
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions p11-kit/modules.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit ae05279

Please sign in to comment.