summaryrefslogtreecommitdiffstats
path: root/lib/libssl/src/ssl/ssl_lib.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2014-05-28 13:03:24 +0000
committerjsing <jsing@openbsd.org>2014-05-28 13:03:24 +0000
commit9d9224c34fa672afefd4702ccd40f7a3f0d33859 (patch)
treeceb592a1008435edad633dfdf1070ac72db0a1ed /lib/libssl/src/ssl/ssl_lib.c
parentMore KNF. (diff)
downloadwireguard-openbsd-9d9224c34fa672afefd4702ccd40f7a3f0d33859.tar.xz
wireguard-openbsd-9d9224c34fa672afefd4702ccd40f7a3f0d33859.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 'lib/libssl/src/ssl/ssl_lib.c')
-rw-r--r--lib/libssl/src/ssl/ssl_lib.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/lib/libssl/src/ssl/ssl_lib.c b/lib/libssl/src/ssl/ssl_lib.c
index e607060d427..bf983542941 100644
--- a/lib/libssl/src/ssl/ssl_lib.c
+++ b/lib/libssl/src/ssl/ssl_lib.c
@@ -549,25 +549,20 @@ SSL_free(SSL *s)
/* Free up if allocated */
#ifndef OPENSSL_NO_TLSEXT
- if (s->tlsext_hostname)
- free(s->tlsext_hostname);
+ free(s->tlsext_hostname);
if (s->initial_ctx)
SSL_CTX_free(s->initial_ctx);
#ifndef OPENSSL_NO_EC
- if (s->tlsext_ecpointformatlist)
- free(s->tlsext_ecpointformatlist);
- if (s->tlsext_ellipticcurvelist)
- free(s->tlsext_ellipticcurvelist);
+ free(s->tlsext_ecpointformatlist);
+ free(s->tlsext_ellipticcurvelist);
#endif /* OPENSSL_NO_EC */
- if (s->tlsext_opaque_prf_input)
- free(s->tlsext_opaque_prf_input);
+ free(s->tlsext_opaque_prf_input);
if (s->tlsext_ocsp_exts)
sk_X509_EXTENSION_pop_free(s->tlsext_ocsp_exts,
X509_EXTENSION_free);
if (s->tlsext_ocsp_ids)
sk_OCSP_RESPID_pop_free(s->tlsext_ocsp_ids, OCSP_RESPID_free);
- if (s->tlsext_ocsp_resp)
- free(s->tlsext_ocsp_resp);
+ free(s->tlsext_ocsp_resp);
#endif
if (s->client_CA != NULL)
@@ -581,8 +576,7 @@ SSL_free(SSL *s)
#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
- if (s->next_proto_negotiated)
- free(s->next_proto_negotiated);
+ free(s->next_proto_negotiated);
#endif
#ifndef OPENSSL_NO_SRTP
@@ -1893,7 +1887,8 @@ SSL_CTX_new(const SSL_METHOD *meth)
#if 0
static void
SSL_COMP_free(SSL_COMP *comp)
- { free(comp);
+{
+ free(comp);
}
#endif
@@ -1954,8 +1949,7 @@ SSL_CTX_free(SSL_CTX *a)
#endif
#ifndef OPENSSL_NO_PSK
- if (a->psk_identity_hint)
- free(a->psk_identity_hint);
+ free(a->psk_identity_hint);
#endif
#ifndef OPENSSL_NO_ENGINE
if (a->client_cert_engine)
@@ -3129,8 +3123,7 @@ SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint)
SSL_R_DATA_LENGTH_TOO_LONG);
return (0);
}
- if (ctx->psk_identity_hint != NULL)
- free(ctx->psk_identity_hint);
+ free(ctx->psk_identity_hint);
if (identity_hint != NULL) {
ctx->psk_identity_hint = BUF_strdup(identity_hint);
if (ctx->psk_identity_hint == NULL)
@@ -3155,8 +3148,7 @@ SSL_use_psk_identity_hint(SSL *s, const char *identity_hint)
SSL_R_DATA_LENGTH_TOO_LONG);
return (0);
}
- if (s->session->psk_identity_hint != NULL)
- free(s->session->psk_identity_hint);
+ free(s->session->psk_identity_hint);
if (identity_hint != NULL) {
s->session->psk_identity_hint = BUF_strdup(identity_hint);
if (s->session->psk_identity_hint == NULL)