mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 02:38:09 +09:00
Fix memory leaks in pki and testcase
This commit is contained in:
@@ -1039,7 +1039,6 @@ ssh_private_key privatekey_from_base64(ssh_session session, const char *b64_pkey
|
|||||||
dsa = PEM_read_bio_DSAPrivateKey(mem, NULL, NULL, (void *) passphrase);
|
dsa = PEM_read_bio_DSAPrivateKey(mem, NULL, NULL, (void *) passphrase);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)BIO_set_close(mem, BIO_NOCLOSE);
|
|
||||||
BIO_free(mem);
|
BIO_free(mem);
|
||||||
|
|
||||||
if (dsa == NULL) {
|
if (dsa == NULL) {
|
||||||
@@ -1083,7 +1082,6 @@ ssh_private_key privatekey_from_base64(ssh_session session, const char *b64_pkey
|
|||||||
rsa = PEM_read_bio_RSAPrivateKey(mem, NULL, NULL, (void *) passphrase);
|
rsa = PEM_read_bio_RSAPrivateKey(mem, NULL, NULL, (void *) passphrase);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)BIO_set_close(mem, BIO_NOCLOSE);
|
|
||||||
BIO_free(mem);
|
BIO_free(mem);
|
||||||
|
|
||||||
if (rsa == NULL) {
|
if (rsa == NULL) {
|
||||||
|
|||||||
@@ -276,6 +276,7 @@ static void torture_pki_pki_publickey_from_privatekey_RSA(void **state) {
|
|||||||
|
|
||||||
free(key_str);
|
free(key_str);
|
||||||
ssh_key_free(key);
|
ssh_key_free(key);
|
||||||
|
ssh_key_free(pubkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void torture_pki_pki_publickey_from_privatekey_DSA(void **state) {
|
static void torture_pki_pki_publickey_from_privatekey_DSA(void **state) {
|
||||||
@@ -300,6 +301,7 @@ static void torture_pki_pki_publickey_from_privatekey_DSA(void **state) {
|
|||||||
|
|
||||||
free(key_str);
|
free(key_str);
|
||||||
ssh_key_free(key);
|
ssh_key_free(key);
|
||||||
|
ssh_key_free(pubkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
int torture_run_tests(void) {
|
int torture_run_tests(void) {
|
||||||
|
|||||||
Reference in New Issue
Block a user