diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2014-05-28 13:03:26 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2014-05-28 13:03:26 +0000 |
commit | 436735632d4994924bff31f02d7b7dab226f2bf6 (patch) | |
tree | 358e1760f95dbd12d24d7eb38148ab5740d4bb6c /lib/libssl/d1_clnt.c | |
parent | 1703dc799b051c805bf5e161e6f91e12f42e5d47 (diff) |
There is no point in checking if a pointer is non-NULL before calling free,
since free already does this for us. Also remove some pointless NULL
assignments, where the result from malloc(3) is immediately assigned to the
same variable.
ok miod@
Diffstat (limited to 'lib/libssl/d1_clnt.c')
-rw-r--r-- | lib/libssl/d1_clnt.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/libssl/d1_clnt.c b/lib/libssl/d1_clnt.c index 8f304a75ff8..d82b099e083 100644 --- a/lib/libssl/d1_clnt.c +++ b/lib/libssl/d1_clnt.c @@ -1231,8 +1231,7 @@ dtls1_send_client_key_exchange(SSL *s) /* Free allocated memory */ BN_CTX_free(bn_ctx); - if (encodedPoint != NULL) - free(encodedPoint); + free(encodedPoint); if (clnt_ecdh != NULL) EC_KEY_free(clnt_ecdh); EVP_PKEY_free(srvr_pub_pkey); @@ -1277,9 +1276,9 @@ dtls1_send_client_key_exchange(SSL *s) t += psk_len; s2n(psk_len, t); - if (s->session->psk_identity_hint != NULL) - free(s->session->psk_identity_hint); - s->session->psk_identity_hint = BUF_strdup(s->ctx->psk_identity_hint); + free(s->session->psk_identity_hint); + s->session->psk_identity_hint = + BUF_strdup(s->ctx->psk_identity_hint); if (s->ctx->psk_identity_hint != NULL && s->session->psk_identity_hint == NULL) { SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE, @@ -1287,8 +1286,7 @@ dtls1_send_client_key_exchange(SSL *s) goto psk_err; } - if (s->session->psk_identity != NULL) - free(s->session->psk_identity); + free(s->session->psk_identity); s->session->psk_identity = BUF_strdup(identity); if (s->session->psk_identity == NULL) { SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE, @@ -1344,8 +1342,7 @@ psk_err: err: #ifndef OPENSSL_NO_ECDH BN_CTX_free(bn_ctx); - if (encodedPoint != NULL) - free(encodedPoint); + free(encodedPoint); if (clnt_ecdh != NULL) EC_KEY_free(clnt_ecdh); EVP_PKEY_free(srvr_pub_pkey); |