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

@@ -2448,13 +2448,11 @@ int MAIN(int argc, char **argv)
OPENSSL_free(buf2_malloc);
#ifndef OPENSSL_NO_RSA
for (i = 0; i < RSA_NUM; i++)
if (rsa_key[i] != NULL)
RSA_free(rsa_key[i]);
RSA_free(rsa_key[i]);
#endif
#ifndef OPENSSL_NO_DSA
for (i = 0; i < DSA_NUM; i++)
if (dsa_key[i] != NULL)
DSA_free(dsa_key[i]);
DSA_free(dsa_key[i]);
#endif
#ifndef OPENSSL_NO_EC