summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2021-07-20 11:19:39 +0200
committerDr. David von Oheimb <dev@ddvo.net>2021-07-22 10:14:47 +0200
commit981a5b7ce3bcdf4748162073c3dbd096c82d3c69 (patch)
tree77dd5f957ecefedbb31534a8e1aad8aebddd2234 /crypto
parentc74188e86c78c4fa47c4a658e1355c40524fadb4 (diff)
OSSL_HTTP_open(): Fix memory leak on TLS connect failure via proxy
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/16119)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/http/http_client.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/http/http_client.c b/crypto/http/http_client.c
index 779e4b7203..bb80836cd1 100644
--- a/crypto/http/http_client.c
+++ b/crypto/http/http_client.c
@@ -926,7 +926,8 @@ OSSL_HTTP_REQ_CTX *OSSL_HTTP_open(const char *server, const char *port,
cbio = (*bio_update_fn)(cbio, arg, 1 /* connect */, use_ssl);
if (cbio == NULL) {
- cbio = orig_bio;
+ if (bio == NULL) /* cbio was not provided by caller */
+ BIO_free_all(orig_bio);
goto end;
}
}