1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-12-08 03:42:12 +03:00

pki: Fix memory leaks from handling pkcs11 uri

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Jakub Jelen
2024-07-02 14:09:34 +02:00
parent 3e0c2275ef
commit 0ce88225c0

View File

@@ -2819,16 +2819,18 @@ int pki_uri_import(const char *uri_name,
if (ossl_type == OSSL_STORE_INFO_PUBKEY && key_type == SSH_KEY_PUBLIC) {
pkey = OSSL_STORE_INFO_get1_PUBKEY(info);
break;
} else if (ossl_type == OSSL_STORE_INFO_PKEY &&
key_type == SSH_KEY_PRIVATE) {
pkey = OSSL_STORE_INFO_get1_PKEY(info);
break;
} else {
SSH_LOG(SSH_LOG_TRACE,
"Ignoring object not matching our type: %d",
ossl_type);
OSSL_STORE_INFO_free(info);
continue;
}
OSSL_STORE_INFO_free(info);
break;
}
OSSL_STORE_close(store);
if (pkey == NULL) {