]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
OSSL_HTTP_open(): Fix memory leak on TLS connect failure via proxy
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Tue, 20 Jul 2021 09:19:39 +0000 (11:19 +0200)
committerDr. David von Oheimb <dev@ddvo.net>
Thu, 22 Jul 2021 08:14:47 +0000 (10:14 +0200)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16119)

crypto/http/http_client.c

index 779e4b7203eb748d3d9ce1b4528ed7b92bd26e4b..bb80836cd1b65d7b73aa2521fe3aa5acc89570b2 100644 (file)
@@ -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;
         }
     }