diff options
author | Rich Salz <rsalz@akamai.com> | 2015-03-24 10:17:37 -0400 |
---|---|---|
committer | Rich Salz <rsalz@akamai.com> | 2015-03-24 23:17:16 -0400 |
commit | d64070838ebba86f00fb3755df5d3e65106e1628 (patch) | |
tree | def90b3063d9ebe0f53920604d02b9786216e327 /ssl/s3_lib.c | |
parent | 1300705a47b9c9498b15a384c6c5348adc342e2c (diff) |
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>
Diffstat (limited to 'ssl/s3_lib.c')
-rw-r--r-- | ssl/s3_lib.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index 6c59824901..9893930eef 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -3138,8 +3138,7 @@ void ssl3_free(SSL *s) if (s->s3->rrec.comp != NULL) OPENSSL_free(s->s3->rrec.comp); #ifndef OPENSSL_NO_DH - if (s->s3->tmp.dh != NULL) - DH_free(s->s3->tmp.dh); + DH_free(s->s3->tmp.dh); #endif #ifndef OPENSSL_NO_EC if (s->s3->tmp.ecdh != NULL) @@ -3181,10 +3180,8 @@ void ssl3_clear(SSL *s) s->s3->rrec.comp = NULL; } #ifndef OPENSSL_NO_DH - if (s->s3->tmp.dh != NULL) { - DH_free(s->s3->tmp.dh); - s->s3->tmp.dh = NULL; - } + DH_free(s->s3->tmp.dh); + s->s3->tmp.dh = NULL; #endif #ifndef OPENSSL_NO_EC if (s->s3->tmp.ecdh != NULL) { @@ -3293,8 +3290,7 @@ long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg) SSLerr(SSL_F_SSL3_CTRL, ERR_R_RSA_LIB); return (ret); } - if (s->cert->rsa_tmp != NULL) - RSA_free(s->cert->rsa_tmp); + RSA_free(s->cert->rsa_tmp); s->cert->rsa_tmp = rsa; ret = 1; } @@ -3329,8 +3325,7 @@ long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg) return (ret); } } - if (s->cert->dh_tmp != NULL) - DH_free(s->cert->dh_tmp); + DH_free(s->cert->dh_tmp); s->cert->dh_tmp = dh; ret = 1; } @@ -3766,8 +3761,7 @@ long ssl3_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_RSA_LIB); return (0); } else { - if (cert->rsa_tmp != NULL) - RSA_free(cert->rsa_tmp); + RSA_free(cert->rsa_tmp); cert->rsa_tmp = rsa; return (1); } @@ -3801,8 +3795,7 @@ long ssl3_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) return 0; } } - if (cert->dh_tmp != NULL) - DH_free(cert->dh_tmp); + DH_free(cert->dh_tmp); cert->dh_tmp = new; return 1; } |