summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2017-01-24 15:11:56 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2017-01-24 15:11:56 +0000
commit6d0c4b10ac4b64202bee87bb577d7d29626c71d9 (patch)
tree5cef70906b52902837dc432054cfa692d4581e63 /lib
parente4193a7dd3b3ebc0dd035764d48bd00a0493f4da (diff)
BUF_MEM_free(), X509_STORE_free() and X509_VERIFY_PARAM_free() all check
for NULL, as does lh_free() - do not do the same from the caller.
Diffstat (limited to 'lib')
-rw-r--r--lib/libssl/s3_clnt.c8
-rw-r--r--lib/libssl/ssl_lib.c20
2 files changed, 10 insertions, 18 deletions
diff --git a/lib/libssl/s3_clnt.c b/lib/libssl/s3_clnt.c
index ecd0f9e8865..0600e7519ea 100644
--- a/lib/libssl/s3_clnt.c
+++ b/lib/libssl/s3_clnt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: s3_clnt.c,v 1.173 2017/01/24 15:04:12 jsing Exp $ */
+/* $OpenBSD: s3_clnt.c,v 1.174 2017/01/24 15:11:55 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -520,10 +520,8 @@ ssl3_connect(SSL *s)
/* clean a few things up */
tls1_cleanup_key_block(s);
- if (s->internal->init_buf != NULL) {
- BUF_MEM_free(s->internal->init_buf);
- s->internal->init_buf = NULL;
- }
+ BUF_MEM_free(s->internal->init_buf);
+ s->internal->init_buf = NULL;
/*
* If we are not 'joining' the last two packets,
diff --git a/lib/libssl/ssl_lib.c b/lib/libssl/ssl_lib.c
index 3c69e66ee11..29bce5414aa 100644
--- a/lib/libssl/ssl_lib.c
+++ b/lib/libssl/ssl_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssl_lib.c,v 1.148 2017/01/24 15:04:12 jsing Exp $ */
+/* $OpenBSD: ssl_lib.c,v 1.149 2017/01/24 15:11:55 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -522,8 +522,7 @@ SSL_free(SSL *s)
if (i > 0)
return;
- if (s->param)
- X509_VERIFY_PARAM_free(s->param);
+ X509_VERIFY_PARAM_free(s->param);
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL, s, &s->internal->ex_data);
@@ -540,8 +539,7 @@ SSL_free(SSL *s)
BIO_free_all(s->rbio);
BIO_free_all(s->wbio);
- if (s->internal->init_buf != NULL)
- BUF_MEM_free(s->internal->init_buf);
+ BUF_MEM_free(s->internal->init_buf);
/* add extra stuff */
sk_SSL_CIPHER_free(s->cipher_list);
@@ -1984,8 +1982,7 @@ SSL_CTX_free(SSL_CTX *ctx)
if (i > 0)
return;
- if (ctx->param)
- X509_VERIFY_PARAM_free(ctx->param);
+ X509_VERIFY_PARAM_free(ctx->param);
/*
* Free internal session cache. However: the remove_cb() may reference
@@ -2001,11 +1998,9 @@ SSL_CTX_free(SSL_CTX *ctx)
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, ctx, &ctx->internal->ex_data);
- if (ctx->internal->sessions != NULL)
- lh_SSL_SESSION_free(ctx->internal->sessions);
+ lh_SSL_SESSION_free(ctx->internal->sessions);
- if (ctx->cert_store != NULL)
- X509_STORE_free(ctx->cert_store);
+ X509_STORE_free(ctx->cert_store);
sk_SSL_CIPHER_free(ctx->cipher_list);
sk_SSL_CIPHER_free(ctx->internal->cipher_list_by_id);
ssl_cert_free(ctx->internal->cert);
@@ -3036,8 +3031,7 @@ SSL_CTX_get_cert_store(const SSL_CTX *ctx)
void
SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *store)
{
- if (ctx->cert_store != NULL)
- X509_STORE_free(ctx->cert_store);
+ X509_STORE_free(ctx->cert_store);
ctx->cert_store = store;
}