Skip to content

Commit ed6d2d2

Browse files
committed
Remove libp11 atexit() cleanup
Client applications are responsible for calling PKCS11_CTX_free().
1 parent 63e2e40 commit ed6d2d2

1 file changed

Lines changed: 1 addition & 14 deletions

File tree

src/p11_load.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,6 @@ static void libp11_global_free()
5151
#endif /* OPENSSL_VERSION_NUMBER */
5252
}
5353

54-
/*
55-
* Free global data if some PKCS11_CTX objects were not freed by the user
56-
*/
57-
static void libp11_atexit()
58-
{
59-
if (pkcs11_global_data_refs > 0) {
60-
pkcs11_global_data_refs = 0;
61-
libp11_global_free();
62-
}
63-
}
64-
6554
/*
6655
* Create a new context
6756
*/
@@ -85,9 +74,7 @@ PKCS11_CTX *pkcs11_CTX_new(void)
8574
cpriv->forkid = get_forkid();
8675
pthread_mutex_init(&cpriv->fork_lock, 0);
8776

88-
if(pkcs11_global_data_refs++ == 0)
89-
atexit(libp11_atexit);
90-
77+
pkcs11_global_data_refs++;
9178
return ctx;
9279
fail:
9380
OPENSSL_free(cpriv);

0 commit comments

Comments
 (0)