summaryrefslogtreecommitdiff
path: root/src/lib/libssl/d1_clnt.c
diff options
context:
space:
mode:
authorjsing <>2014-05-28 13:03:25 +0000
committerjsing <>2014-05-28 13:03:25 +0000
commit1904ce01988b6ea0f5775507b4d812459c5b3f50 (patch)
tree60af46eb8cb0fcb0e51840739e416c98c124d73c /src/lib/libssl/d1_clnt.c
parent60cd1d60f58b32225afb881559d08dbc68a2eb79 (diff)
downloadopenbsd-1904ce01988b6ea0f5775507b4d812459c5b3f50.tar.gz
openbsd-1904ce01988b6ea0f5775507b4d812459c5b3f50.tar.bz2
openbsd-1904ce01988b6ea0f5775507b4d812459c5b3f50.zip
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 'src/lib/libssl/d1_clnt.c')
-rw-r--r--src/lib/libssl/d1_clnt.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/lib/libssl/d1_clnt.c b/src/lib/libssl/d1_clnt.c
index 8f304a75ff..d82b099e08 100644
--- a/src/lib/libssl/d1_clnt.c
+++ b/src/lib/libssl/d1_clnt.c
@@ -1231,8 +1231,7 @@ dtls1_send_client_key_exchange(SSL *s)
1231 1231
1232 /* Free allocated memory */ 1232 /* Free allocated memory */
1233 BN_CTX_free(bn_ctx); 1233 BN_CTX_free(bn_ctx);
1234 if (encodedPoint != NULL) 1234 free(encodedPoint);
1235 free(encodedPoint);
1236 if (clnt_ecdh != NULL) 1235 if (clnt_ecdh != NULL)
1237 EC_KEY_free(clnt_ecdh); 1236 EC_KEY_free(clnt_ecdh);
1238 EVP_PKEY_free(srvr_pub_pkey); 1237 EVP_PKEY_free(srvr_pub_pkey);
@@ -1277,9 +1276,9 @@ dtls1_send_client_key_exchange(SSL *s)
1277 t += psk_len; 1276 t += psk_len;
1278 s2n(psk_len, t); 1277 s2n(psk_len, t);
1279 1278
1280 if (s->session->psk_identity_hint != NULL) 1279 free(s->session->psk_identity_hint);
1281 free(s->session->psk_identity_hint); 1280 s->session->psk_identity_hint =
1282 s->session->psk_identity_hint = BUF_strdup(s->ctx->psk_identity_hint); 1281 BUF_strdup(s->ctx->psk_identity_hint);
1283 if (s->ctx->psk_identity_hint != NULL && 1282 if (s->ctx->psk_identity_hint != NULL &&
1284 s->session->psk_identity_hint == NULL) { 1283 s->session->psk_identity_hint == NULL) {
1285 SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE, 1284 SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE,
@@ -1287,8 +1286,7 @@ dtls1_send_client_key_exchange(SSL *s)
1287 goto psk_err; 1286 goto psk_err;
1288 } 1287 }
1289 1288
1290 if (s->session->psk_identity != NULL) 1289 free(s->session->psk_identity);
1291 free(s->session->psk_identity);
1292 s->session->psk_identity = BUF_strdup(identity); 1290 s->session->psk_identity = BUF_strdup(identity);
1293 if (s->session->psk_identity == NULL) { 1291 if (s->session->psk_identity == NULL) {
1294 SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE, 1292 SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE,
@@ -1344,8 +1342,7 @@ psk_err:
1344err: 1342err:
1345#ifndef OPENSSL_NO_ECDH 1343#ifndef OPENSSL_NO_ECDH
1346 BN_CTX_free(bn_ctx); 1344 BN_CTX_free(bn_ctx);
1347 if (encodedPoint != NULL) 1345 free(encodedPoint);
1348 free(encodedPoint);
1349 if (clnt_ecdh != NULL) 1346 if (clnt_ecdh != NULL)
1350 EC_KEY_free(clnt_ecdh); 1347 EC_KEY_free(clnt_ecdh);
1351 EVP_PKEY_free(srvr_pub_pkey); 1348 EVP_PKEY_free(srvr_pub_pkey);