free NULL cleanup

Start ensuring all OpenSSL "free" routines allow NULL, and remove
any if check before calling them.
This gets DH_free, DSA_free, RSA_free

Reviewed-by: Matt Caswell <matt@openssl.org>
This commit is contained in:
Rich Salz
2015-03-24 10:17:37 -04:00
parent 1300705a47
commit d64070838e
34 changed files with 58 additions and 108 deletions

View File

@@ -3180,8 +3180,7 @@ static RSA *tmp_rsa_cb(SSL *s, int is_export, int keylength)
}
if (!BN_set_word(bn, RSA_F4) || ((rsa_tmp = RSA_new()) == NULL) ||
!RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL)) {
if (rsa_tmp)
RSA_free(rsa_tmp);
RSA_free(rsa_tmp);
rsa_tmp = NULL;
}
if (!s_quiet) {