diff options
author | miod <> | 2014-07-11 15:40:32 +0000 |
---|---|---|
committer | miod <> | 2014-07-11 15:40:32 +0000 |
commit | 0c704e3208713fc9baf5006671edf39a365e1009 (patch) | |
tree | 92977bfa3184f1b8df733c994bc8f15a483d9932 | |
parent | cedaabbf47d82e83c060fc736f23c938412ed50c (diff) | |
download | openbsd-0c704e3208713fc9baf5006671edf39a365e1009.tar.gz openbsd-0c704e3208713fc9baf5006671edf39a365e1009.tar.bz2 openbsd-0c704e3208713fc9baf5006671edf39a365e1009.zip |
Fix a memory leak in BIO_free() which no current BIO can trigger; OpenSSL
PR #3439 via OpenSSL trunk
-rw-r--r-- | src/lib/libcrypto/bio/bio_lib.c | 7 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/bio/bio_lib.c | 7 |
2 files changed, 6 insertions, 8 deletions
diff --git a/src/lib/libcrypto/bio/bio_lib.c b/src/lib/libcrypto/bio/bio_lib.c index 41b3d31678..a2b34a2f80 100644 --- a/src/lib/libcrypto/bio/bio_lib.c +++ b/src/lib/libcrypto/bio/bio_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bio_lib.c,v 1.19 2014/07/11 08:44:47 jsing Exp $ */ | 1 | /* $OpenBSD: bio_lib.c,v 1.20 2014/07/11 15:40:32 miod 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 | * |
@@ -125,9 +125,8 @@ BIO_free(BIO *a) | |||
125 | 125 | ||
126 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, a, &a->ex_data); | 126 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, a, &a->ex_data); |
127 | 127 | ||
128 | if ((a->method == NULL) || (a->method->destroy == NULL)) | 128 | if (a->method != NULL && a->method->destroy != NULL) |
129 | return (1); | 129 | a->method->destroy(a); |
130 | a->method->destroy(a); | ||
131 | free(a); | 130 | free(a); |
132 | return (1); | 131 | return (1); |
133 | } | 132 | } |
diff --git a/src/lib/libssl/src/crypto/bio/bio_lib.c b/src/lib/libssl/src/crypto/bio/bio_lib.c index 41b3d31678..a2b34a2f80 100644 --- a/src/lib/libssl/src/crypto/bio/bio_lib.c +++ b/src/lib/libssl/src/crypto/bio/bio_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bio_lib.c,v 1.19 2014/07/11 08:44:47 jsing Exp $ */ | 1 | /* $OpenBSD: bio_lib.c,v 1.20 2014/07/11 15:40:32 miod 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 | * |
@@ -125,9 +125,8 @@ BIO_free(BIO *a) | |||
125 | 125 | ||
126 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, a, &a->ex_data); | 126 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, a, &a->ex_data); |
127 | 127 | ||
128 | if ((a->method == NULL) || (a->method->destroy == NULL)) | 128 | if (a->method != NULL && a->method->destroy != NULL) |
129 | return (1); | 129 | a->method->destroy(a); |
130 | a->method->destroy(a); | ||
131 | free(a); | 130 | free(a); |
132 | return (1); | 131 | return (1); |
133 | } | 132 | } |