]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
pkcs11: Free copied name of PKCS#11 module in error cases
authorTobias Brunner <tobias@strongswan.org>
Tue, 4 Mar 2025 13:48:42 +0000 (14:48 +0100)
committerTobias Brunner <tobias@strongswan.org>
Tue, 4 Mar 2025 13:48:42 +0000 (14:48 +0100)
src/libstrongswan/plugins/pkcs11/pkcs11_library.c

index 95dbd1792c55979c38126d8554ea75ad41b7be03..43da98f4f38a69f24ad9ea0a31d949ca8f1ce2c4 100644 (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;
        }