free cleanup almost the finale

Add OPENSSL_clear_free which merges cleanse and free.
(Names was picked to be similar to BN_clear_free, etc.)
Removed OPENSSL_freeFunc macro.
Fixed the small simple ones that are left:
        CRYPTO_free CRYPTO_free_locked OPENSSL_free_locked

Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
Rich Salz
2015-04-30 17:57:32 -04:00
parent 68dc682499
commit 4b45c6e52b
56 changed files with 121 additions and 311 deletions

View File

@@ -1994,8 +1994,7 @@ int s_client_main(int argc, char **argv)
#endif
SSL_CTX_free(ctx);
X509_free(cert);
if (crls)
sk_X509_CRL_pop_free(crls, X509_CRL_free);
sk_X509_CRL_pop_free(crls, X509_CRL_free);
EVP_PKEY_free(key);
sk_X509_pop_free(chain, X509_free);
if (pass)
@@ -2008,18 +2007,9 @@ int s_client_main(int argc, char **argv)
if (jpake_secret && psk_key)
OPENSSL_free(psk_key);
#endif
if (cbuf != NULL) {
OPENSSL_cleanse(cbuf, BUFSIZZ);
OPENSSL_free(cbuf);
}
if (sbuf != NULL) {
OPENSSL_cleanse(sbuf, BUFSIZZ);
OPENSSL_free(sbuf);
}
if (mbuf != NULL) {
OPENSSL_cleanse(mbuf, BUFSIZZ);
OPENSSL_free(mbuf);
}
OPENSSL_clear_free(cbuf, BUFSIZZ);
OPENSSL_clear_free(sbuf, BUFSIZZ);
OPENSSL_clear_free(mbuf, BUFSIZZ);
BIO_free(bio_c_out);
bio_c_out = NULL;
BIO_free(bio_c_msg);