From d8f90d300eb76e04dec2caba99f78e7f8a99b215 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Fri, 12 Aug 2016 16:16:38 +0200 Subject: Fix leak when C_Initialize() is called from child The test case added for bug 90289 (commit c73edd00) revealed that some of the C_Initialize() implementations do not consider the case where it is called from the parent process and then from the child process, without calling C_Finalize() in between. --- 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 f52c6e1..1ec0f1d 100644 --- a/p11-kit/modules.c +++ b/p11-kit/modules.c @@ -1480,6 +1480,8 @@ managed_C_Initialize (CK_X_FUNCTION_LIST *self, else rv = initialize_module_inlock_reentrant (managed->mod); if (rv == CKR_OK) { + if (managed->sessions) + p11_dict_free (managed->sessions); managed->sessions = sessions; managed->initialized = p11_forkid; } else { -- cgit v1.1