mirror of
https://github.com/openssl/openssl.git
synced 2026-01-18 17:11:31 +01:00
demos/bio/sconnect.c: Add check for BIO_new()
Add check for the return value of BIO_new() to guarantee the success.
Fixes: 0f113f3ee4 ("Run util/openssl-format-source -v -c .")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27919)
This commit is contained in:
committed by
Neil Horman
parent
7ed1f08326
commit
323e48b6fb
@@ -65,10 +65,18 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Use it inside an SSL BIO */
|
||||
ssl_bio = BIO_new(BIO_f_ssl());
|
||||
if (ssl_bio == NULL)
|
||||
goto err;
|
||||
|
||||
BIO_set_ssl(ssl_bio, ssl, BIO_CLOSE);
|
||||
|
||||
/* Lets use a connect BIO under the SSL BIO */
|
||||
out = BIO_new(BIO_s_connect());
|
||||
if (out == NULL) {
|
||||
BIO_free(ssl_bio);
|
||||
goto err;
|
||||
}
|
||||
|
||||
BIO_set_conn_hostname(out, hostport);
|
||||
|
||||
/* The BIO has parsed the host:port and even IPv6 literals in [] */
|
||||
|
||||
Reference in New Issue
Block a user