diff options
author | Matt Caswell <matt@openssl.org> | 2014-07-09 23:29:17 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2014-07-09 23:29:17 +0100 |
commit | 66816c53bea0ecddb9448da7ea9a51a334496127 (patch) | |
tree | e60209a8d63ae42a01946d344cbec3dbf0a35d12 /crypto/bio/bio_lib.c | |
parent | 1b0fe79f3ee27ebd20510da3af9ec04c6ee0f800 (diff) | |
download | openssl-66816c53bea0ecddb9448da7ea9a51a334496127.tar.gz |
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/bio/bio_lib.c')
-rw-r--r-- | crypto/bio/bio_lib.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c index 9c9646afa8..4793a453e4 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); } |