From: Dr. David von Oheimb Date: Tue, 20 Jul 2021 09:19:39 +0000 (+0200) Subject: OSSL_HTTP_open(): Fix memory leak on TLS connect failure via proxy X-Git-Tag: openssl-3.0.0-beta2~34 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=981a5b7ce3bcdf4748162073c3dbd096c82d3c69;p=thirdparty%2Fopenssl.git OSSL_HTTP_open(): Fix memory leak on TLS connect failure via proxy Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/16119) --- diff --git a/crypto/http/http_client.c b/crypto/http/http_client.c index 779e4b7203e..bb80836cd1b 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; } }