aboutsummaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2014-07-09 23:29:17 +0100
committerMatt Caswell <matt@openssl.org>2014-07-09 23:29:17 +0100
commit66816c53bea0ecddb9448da7ea9a51a334496127 (patch)
treee60209a8d63ae42a01946d344cbec3dbf0a35d12 /crypto
parent1b0fe79f3ee27ebd20510da3af9ec04c6ee0f800 (diff)
downloadopenssl-66816c53bea0ecddb9448da7ea9a51a334496127.zip
openssl-66816c53bea0ecddb9448da7ea9a51a334496127.tar.gz
openssl-66816c53bea0ecddb9448da7ea9a51a334496127.tar.bz2
Fix memory leak in BIO_free if there is no destroy function.
Based on an original patch by Neitrino Photonov <neitrinoph@gmail.com> PR#3439
Diffstat (limited to 'crypto')
-rw-r--r--crypto/bio/bio_lib.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c
index 9c9646a..4793a45 100644
--- a/crypto/bio/bio_lib.c
+++ b/crypto/bio/bio_lib.c
@@ -132,8 +132,8 @@ int 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);
OPENSSL_free(a);
return(1);
}