]> git.ipfire.org Git - thirdparty/strongswan.git/blobdiff - src/libstrongswan/plugins/pkcs11/pkcs11_manager.c
Use thread save settings alloc_str function where appropriate
[thirdparty/strongswan.git] / src / libstrongswan / plugins / pkcs11 / pkcs11_manager.c
index 431cd6a2c9f161204aa2eaa64c3ebd63ade3aaf3..7579e0e2edbf714f0a9417b1e1c41cbf0771a337 100644 (file)
@@ -74,7 +74,8 @@ static void lib_entry_destroy(lib_entry_t *entry)
        {
                entry->job->cancel(entry->job);
        }
-       entry->lib->destroy(entry->lib);
+       DESTROY_IF(entry->lib);
+       free(entry->path);
        free(entry);
 }
 
@@ -365,12 +366,12 @@ pkcs11_manager_t *pkcs11_manager_create(pkcs11_manager_token_event_t cb,
                        .this = this,
                );
 
-               entry->path = lib->settings->get_str(lib->settings,
+               entry->path = lib->settings->alloc_str(lib->settings,
                                "libstrongswan.plugins.pkcs11.modules.%s.path", NULL, module);
                if (!entry->path)
                {
                        DBG1(DBG_CFG, "PKCS11 module '%s' lacks library path", module);
-                       free(entry);
+                       lib_entry_destroy(entry);
                        continue;
                }
                entry->lib = pkcs11_library_create(module, entry->path,
@@ -379,7 +380,7 @@ pkcs11_manager_t *pkcs11_manager_create(pkcs11_manager_token_event_t cb,
                                                        FALSE, module));
                if (!entry->lib)
                {
-                       free(entry);
+                       lib_entry_destroy(entry);
                        continue;
                }
                this->libs->insert_last(this->libs, entry);