aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2012-10-08 11:15:35 +0200
committerTobias Brunner <tobias@strongswan.org>2012-10-18 14:42:09 +0200
commitca1c2ee2813ad0f7f15724b216549c3fc1c9ac11 (patch)
treef235cd918781b79d20a9bfd9c99b81d8fa42d042 /src
parentc30573467ba1d829a836579a3f80003aa457ddc2 (diff)
downloadstrongswan-ca1c2ee2813ad0f7f15724b216549c3fc1c9ac11.tar.bz2
strongswan-ca1c2ee2813ad0f7f15724b216549c3fc1c9ac11.tar.xz
Copy the name of pkcs11_library_t objects
Strings returned by settings_t.create_section_enumerator will be freed when the config is reloaded.
Diffstat (limited to 'src')
-rw-r--r--src/libstrongswan/plugins/pkcs11/pkcs11_library.c3
-rw-r--r--src/libstrongswan/plugins/pkcs11/pkcs11_library.h2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/libstrongswan/plugins/pkcs11/pkcs11_library.c b/src/libstrongswan/plugins/pkcs11/pkcs11_library.c
index 97c3d2fcf..0d89a97eb 100644
--- a/src/libstrongswan/plugins/pkcs11/pkcs11_library.c
+++ b/src/libstrongswan/plugins/pkcs11/pkcs11_library.c
@@ -895,6 +895,7 @@ METHOD(pkcs11_library_t, destroy, void,
{
this->public.f->C_Finalize(NULL);
dlclose(this->handle);
+ free(this->name);
free(this);
}
@@ -1077,7 +1078,7 @@ pkcs11_library_t *pkcs11_library_create(char *name, char *file, bool os_locking)
.get_ck_attribute = _get_ck_attribute,
.destroy = _destroy,
},
- .name = name,
+ .name = strdup(name),
.handle = dlopen(file, RTLD_LAZY),
);
diff --git a/src/libstrongswan/plugins/pkcs11/pkcs11_library.h b/src/libstrongswan/plugins/pkcs11/pkcs11_library.h
index e76e65e07..50ed036ac 100644
--- a/src/libstrongswan/plugins/pkcs11/pkcs11_library.h
+++ b/src/libstrongswan/plugins/pkcs11/pkcs11_library.h
@@ -161,7 +161,7 @@ void pkcs11_library_trim(char *str, int len);
/**
* Create a pkcs11_library instance.
*
- * @param name an arbitrary name, for debugging
+ * @param name an arbitrary name (for debugging), cloned
* @param file pkcs11 library file to dlopen()
* @param os_lock enforce OS Locking for this library
* @return library abstraction