mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-30 13:01:23 +03:00
pki_crypto: Avoid potential memory leak
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
2ec633f33d
commit
c4ddf62f7e
@@ -455,7 +455,7 @@ int pki_key_generate_dss(ssh_key key, int parameter){
|
|||||||
int rc;
|
int rc;
|
||||||
#if OPENSSL_VERSION_NUMBER > 0x10100000L
|
#if OPENSSL_VERSION_NUMBER > 0x10100000L
|
||||||
key->dsa = DSA_new();
|
key->dsa = DSA_new();
|
||||||
if (!key->dsa) {
|
if (key->dsa == NULL) {
|
||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
rc = DSA_generate_parameters_ex(key->dsa,
|
rc = DSA_generate_parameters_ex(key->dsa,
|
||||||
@@ -466,6 +466,8 @@ int pki_key_generate_dss(ssh_key key, int parameter){
|
|||||||
NULL, /* h_ret */
|
NULL, /* h_ret */
|
||||||
NULL); /* cb */
|
NULL); /* cb */
|
||||||
if (rc != 1) {
|
if (rc != 1) {
|
||||||
|
DSA_free(key->dsa);
|
||||||
|
key->dsa = NULL;
|
||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user