Skip to content

Commit

Permalink
pkcsconf: Avoid segfault when dlopen of libopencryptoki.so has failed
Browse files Browse the repository at this point in the history
In such case the FunctionPtr is left NULL, so do not try to dereference it.

Signed-off-by: Ingo Franzki <[email protected]>
  • Loading branch information
ifranzki committed Apr 21, 2022
1 parent 5859f13 commit e20af6b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions usr/sbin/pkcsconf/pkcsconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1174,12 +1174,13 @@ CK_RV init(void)

CK_RV cleanup(void)
{
CK_RV rc; // Return Code
CK_RV rc = CKR_OK; // Return Code

/* To clean up we will free the slot list we create, call the Finalize
* routine for PKCS11 and close the dynamically linked library */
free(SlotList);
rc = FunctionPtr->C_Finalize(NULL);
if (FunctionPtr)
rc = FunctionPtr->C_Finalize(NULL);
if (dllPtr)
dlclose(dllPtr);

Expand Down

0 comments on commit e20af6b

Please sign in to comment.