summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordoug <>2015-07-19 20:32:18 +0000
committerdoug <>2015-07-19 20:32:18 +0000
commite1b84c43076222a250e436e71045972c584515ce (patch)
treecbd31a1076f71b0161d2ea3b691a126f3d856a33
parent243442e0f6d87748dcaccc2d2d3bf5605be3e3a9 (diff)
downloadopenbsd-e1b84c43076222a250e436e71045972c584515ce.tar.gz
openbsd-e1b84c43076222a250e436e71045972c584515ce.tar.bz2
openbsd-e1b84c43076222a250e436e71045972c584515ce.zip
Allow *_free() functions in libssl to handle NULL input.
This mimics free()'s behavior which makes error handling simpler. ok bcook@ miod@
-rw-r--r--src/lib/libssl/d1_both.c4
-rw-r--r--src/lib/libssl/d1_lib.c5
-rw-r--r--src/lib/libssl/src/ssl/d1_both.c4
-rw-r--r--src/lib/libssl/src/ssl/d1_lib.c5
-rw-r--r--src/lib/libssl/src/ssl/s3_enc.c5
-rw-r--r--src/lib/libssl/src/ssl/ssl_lib.c5
-rw-r--r--src/lib/libssl/src/ssl/t1_lib.c5
-rw-r--r--src/lib/libssl/ssl_lib.c5
-rw-r--r--src/lib/libssl/t1_lib.c5
9 files changed, 34 insertions, 9 deletions
diff --git a/src/lib/libssl/d1_both.c b/src/lib/libssl/d1_both.c
index 5c93af8bd9..b479c61322 100644
--- a/src/lib/libssl/d1_both.c
+++ b/src/lib/libssl/d1_both.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_both.c,v 1.33 2015/07/18 23:00:23 doug Exp $ */ 1/* $OpenBSD: d1_both.c,v 1.34 2015/07/19 20:32:18 doug Exp $ */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -209,6 +209,8 @@ dtls1_hm_fragment_new(unsigned long frag_len, int reassembly)
209static void 209static void
210dtls1_hm_fragment_free(hm_fragment *frag) 210dtls1_hm_fragment_free(hm_fragment *frag)
211{ 211{
212 if (frag == NULL)
213 return;
212 214
213 if (frag->msg_header.is_ccs) { 215 if (frag->msg_header.is_ccs) {
214 EVP_CIPHER_CTX_free( 216 EVP_CIPHER_CTX_free(
diff --git a/src/lib/libssl/d1_lib.c b/src/lib/libssl/d1_lib.c
index dd789ccc70..b269efe469 100644
--- a/src/lib/libssl/d1_lib.c
+++ b/src/lib/libssl/d1_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_lib.c,v 1.28 2015/03/19 14:00:22 tedu Exp $ */ 1/* $OpenBSD: d1_lib.c,v 1.29 2015/07/19 20:32:18 doug Exp $ */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -190,6 +190,9 @@ dtls1_clear_queues(SSL *s)
190void 190void
191dtls1_free(SSL *s) 191dtls1_free(SSL *s)
192{ 192{
193 if (s == NULL)
194 return;
195
193 ssl3_free(s); 196 ssl3_free(s);
194 197
195 dtls1_clear_queues(s); 198 dtls1_clear_queues(s);
diff --git a/src/lib/libssl/src/ssl/d1_both.c b/src/lib/libssl/src/ssl/d1_both.c
index 5c93af8bd9..b479c61322 100644
--- a/src/lib/libssl/src/ssl/d1_both.c
+++ b/src/lib/libssl/src/ssl/d1_both.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_both.c,v 1.33 2015/07/18 23:00:23 doug Exp $ */ 1/* $OpenBSD: d1_both.c,v 1.34 2015/07/19 20:32:18 doug Exp $ */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -209,6 +209,8 @@ dtls1_hm_fragment_new(unsigned long frag_len, int reassembly)
209static void 209static void
210dtls1_hm_fragment_free(hm_fragment *frag) 210dtls1_hm_fragment_free(hm_fragment *frag)
211{ 211{
212 if (frag == NULL)
213 return;
212 214
213 if (frag->msg_header.is_ccs) { 215 if (frag->msg_header.is_ccs) {
214 EVP_CIPHER_CTX_free( 216 EVP_CIPHER_CTX_free(
diff --git a/src/lib/libssl/src/ssl/d1_lib.c b/src/lib/libssl/src/ssl/d1_lib.c
index dd789ccc70..b269efe469 100644
--- a/src/lib/libssl/src/ssl/d1_lib.c
+++ b/src/lib/libssl/src/ssl/d1_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_lib.c,v 1.28 2015/03/19 14:00:22 tedu Exp $ */ 1/* $OpenBSD: d1_lib.c,v 1.29 2015/07/19 20:32:18 doug Exp $ */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -190,6 +190,9 @@ dtls1_clear_queues(SSL *s)
190void 190void
191dtls1_free(SSL *s) 191dtls1_free(SSL *s)
192{ 192{
193 if (s == NULL)
194 return;
195
193 ssl3_free(s); 196 ssl3_free(s);
194 197
195 dtls1_clear_queues(s); 198 dtls1_clear_queues(s);
diff --git a/src/lib/libssl/src/ssl/s3_enc.c b/src/lib/libssl/src/ssl/s3_enc.c
index c30b7519fb..bfa719df5f 100644
--- a/src/lib/libssl/src/ssl/s3_enc.c
+++ b/src/lib/libssl/src/ssl/s3_enc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s3_enc.c,v 1.60 2015/06/17 14:27:56 jsing Exp $ */ 1/* $OpenBSD: s3_enc.c,v 1.61 2015/07/19 20:32:18 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -491,6 +491,9 @@ ssl3_free_digest_list(SSL *s)
491{ 491{
492 int i; 492 int i;
493 493
494 if (s == NULL)
495 return;
496
494 if (s->s3->handshake_dgst == NULL) 497 if (s->s3->handshake_dgst == NULL)
495 return; 498 return;
496 for (i = 0; i < SSL_MAX_DIGEST; i++) { 499 for (i = 0; i < SSL_MAX_DIGEST; i++) {
diff --git a/src/lib/libssl/src/ssl/ssl_lib.c b/src/lib/libssl/src/ssl/ssl_lib.c
index 1dd518d0b8..629ad03554 100644
--- a/src/lib/libssl/src/ssl/ssl_lib.c
+++ b/src/lib/libssl/src/ssl/ssl_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_lib.c,v 1.104 2015/06/28 00:08:27 doug Exp $ */ 1/* $OpenBSD: ssl_lib.c,v 1.105 2015/07/19 20:32:18 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -2825,6 +2825,9 @@ ssl_init_wbio_buffer(SSL *s, int push)
2825void 2825void
2826ssl_free_wbio_buffer(SSL *s) 2826ssl_free_wbio_buffer(SSL *s)
2827{ 2827{
2828 if (s == NULL)
2829 return;
2830
2828 if (s->bbio == NULL) 2831 if (s->bbio == NULL)
2829 return; 2832 return;
2830 2833
diff --git a/src/lib/libssl/src/ssl/t1_lib.c b/src/lib/libssl/src/ssl/t1_lib.c
index b0f0de3bd8..70823bf8e7 100644
--- a/src/lib/libssl/src/ssl/t1_lib.c
+++ b/src/lib/libssl/src/ssl/t1_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t1_lib.c,v 1.79 2015/07/17 15:50:37 doug Exp $ */ 1/* $OpenBSD: t1_lib.c,v 1.80 2015/07/19 20:32:18 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -198,6 +198,9 @@ tls1_new(SSL *s)
198void 198void
199tls1_free(SSL *s) 199tls1_free(SSL *s)
200{ 200{
201 if (s == NULL)
202 return;
203
201 free(s->tlsext_session_ticket); 204 free(s->tlsext_session_ticket);
202 ssl3_free(s); 205 ssl3_free(s);
203} 206}
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c
index 1dd518d0b8..629ad03554 100644
--- a/src/lib/libssl/ssl_lib.c
+++ b/src/lib/libssl/ssl_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_lib.c,v 1.104 2015/06/28 00:08:27 doug Exp $ */ 1/* $OpenBSD: ssl_lib.c,v 1.105 2015/07/19 20:32:18 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -2825,6 +2825,9 @@ ssl_init_wbio_buffer(SSL *s, int push)
2825void 2825void
2826ssl_free_wbio_buffer(SSL *s) 2826ssl_free_wbio_buffer(SSL *s)
2827{ 2827{
2828 if (s == NULL)
2829 return;
2830
2828 if (s->bbio == NULL) 2831 if (s->bbio == NULL)
2829 return; 2832 return;
2830 2833
diff --git a/src/lib/libssl/t1_lib.c b/src/lib/libssl/t1_lib.c
index b0f0de3bd8..70823bf8e7 100644
--- a/src/lib/libssl/t1_lib.c
+++ b/src/lib/libssl/t1_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t1_lib.c,v 1.79 2015/07/17 15:50:37 doug Exp $ */ 1/* $OpenBSD: t1_lib.c,v 1.80 2015/07/19 20:32:18 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -198,6 +198,9 @@ tls1_new(SSL *s)
198void 198void
199tls1_free(SSL *s) 199tls1_free(SSL *s)
200{ 200{
201 if (s == NULL)
202 return;
203
201 free(s->tlsext_session_ticket); 204 free(s->tlsext_session_ticket);
202 ssl3_free(s); 205 ssl3_free(s);
203} 206}