pkcs11: Free copied name of PKCS#11 module in error cases

This commit is contained in:
Tobias Brunner 2025-03-04 14:48:42 +01:00
parent 8fc09ae158
commit a70ba4d600

View File

@ -1170,6 +1170,7 @@ pkcs11_library_t *pkcs11_library_create(char *name, char *file, bool os_locking)
if (!this->handle)
{
DBG1(DBG_CFG, "opening PKCS#11 library failed: %s", dlerror());
free(this->name);
free(this);
return NULL;
}
@ -1177,6 +1178,7 @@ pkcs11_library_t *pkcs11_library_create(char *name, char *file, bool os_locking)
if (!initialize(this, name, file, os_locking))
{
dlclose(this->handle);
free(this->name);
free(this);
return NULL;
}