summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2016-08-12 16:16:38 +0200
committerStef Walter <stefw@redhat.com>2016-08-22 11:57:00 +0200
commitd8f90d300eb76e04dec2caba99f78e7f8a99b215 (patch)
tree58bf327216cee1827f1d3fc6878f161bc1f05e8d /common
parent8afd8d92771d279b38acc098c84027b2cf0dd168 (diff)
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.
Diffstat (limited to 'common')
-rw-r--r--common/mock.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/common/mock.c b/common/mock.c
index 1b0aea7..c3f2503 100644
--- a/common/mock.c
+++ b/common/mock.c
@@ -422,9 +422,12 @@ mock_C_Initialize (CK_VOID_PTR init_args)
/* We store CK_ULONG as pointers here, so verify that they fit */
assert (sizeof (CK_ULONG) <= sizeof (void *));
+ free (the_pin);
the_pin = (CK_UTF8CHAR_PTR)strdup ("booo");
n_the_pin = 4;
+ if (the_sessions)
+ p11_dict_free (the_sessions);
the_sessions = p11_dict_new (p11_dict_direct_hash,
p11_dict_direct_equal,
NULL, free_session);