summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2014-07-11 15:40:32 +0000
committermiod <miod@openbsd.org>2014-07-11 15:40:32 +0000
commit7803ca5e734f9571fcd4a838d132ffe383ebb259 (patch)
treeefc6771f12eef18c63fba243c4ef92c0f333acbf /lib
parentAdd a time.log file that accumulates timing information about the (diff)
downloadwireguard-openbsd-7803ca5e734f9571fcd4a838d132ffe383ebb259.tar.xz
wireguard-openbsd-7803ca5e734f9571fcd4a838d132ffe383ebb259.zip
Fix a memory leak in BIO_free() which no current BIO can trigger; OpenSSL
PR #3439 via OpenSSL trunk
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/bio/bio_lib.c7
-rw-r--r--lib/libssl/src/crypto/bio/bio_lib.c7
2 files changed, 6 insertions, 8 deletions
diff --git a/lib/libcrypto/bio/bio_lib.c b/lib/libcrypto/bio/bio_lib.c
index 41b3d31678f..a2b34a2f80f 100644
--- a/lib/libcrypto/bio/bio_lib.c
+++ b/lib/libcrypto/bio/bio_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bio_lib.c,v 1.19 2014/07/11 08:44:47 jsing Exp $ */
+/* $OpenBSD: bio_lib.c,v 1.20 2014/07/11 15:40:32 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -125,9 +125,8 @@ BIO_free(BIO *a)
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, a, &a->ex_data);
- if ((a->method == NULL) || (a->method->destroy == NULL))
- return (1);
- a->method->destroy(a);
+ if (a->method != NULL && a->method->destroy != NULL)
+ a->method->destroy(a);
free(a);
return (1);
}
diff --git a/lib/libssl/src/crypto/bio/bio_lib.c b/lib/libssl/src/crypto/bio/bio_lib.c
index 41b3d31678f..a2b34a2f80f 100644
--- a/lib/libssl/src/crypto/bio/bio_lib.c
+++ b/lib/libssl/src/crypto/bio/bio_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bio_lib.c,v 1.19 2014/07/11 08:44:47 jsing Exp $ */
+/* $OpenBSD: bio_lib.c,v 1.20 2014/07/11 15:40:32 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -125,9 +125,8 @@ BIO_free(BIO *a)
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, a, &a->ex_data);
- if ((a->method == NULL) || (a->method->destroy == NULL))
- return (1);
- a->method->destroy(a);
+ if (a->method != NULL && a->method->destroy != NULL)
+ a->method->destroy(a);
free(a);
return (1);
}