From 11b7d46fa7e2684e0ad0f12a7806163dba99983d Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Wed, 6 Sep 2023 12:36:43 +0100 Subject: Return NULL if we fail to create a BIO in the demos/quicserver Strictly speaking the previous code was still correct since BIO_set_fd is tolerant of a NULL BIO. But this way is more clear. Reviewed-by: Tomas Mraz Reviewed-by: Hugo Landau (Merged from https://github.com/openssl/openssl/pull/21950) --- doc/man7/ossl-guide-quic-client-block.pod | 6 ++++-- doc/man7/ossl-guide-tls-client-block.pod | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'doc') diff --git a/doc/man7/ossl-guide-quic-client-block.pod b/doc/man7/ossl-guide-quic-client-block.pod index 4cf8bdd3b8..fc8912086d 100644 --- a/doc/man7/ossl-guide-quic-client-block.pod +++ b/doc/man7/ossl-guide-quic-client-block.pod @@ -165,10 +165,12 @@ associate it with a BIO object: BIO *bio; - /* Create a BIO to wrap the socket*/ + /* Create a BIO to wrap the socket */ bio = BIO_new(BIO_s_datagram()); - if (bio == NULL) + if (bio == NULL) { BIO_closesocket(sock); + return NULL; + } /* * Associate the newly created BIO with the underlying socket. By diff --git a/doc/man7/ossl-guide-tls-client-block.pod b/doc/man7/ossl-guide-tls-client-block.pod index 236553fafd..865a5353b3 100644 --- a/doc/man7/ossl-guide-tls-client-block.pod +++ b/doc/man7/ossl-guide-tls-client-block.pod @@ -222,10 +222,12 @@ BIO object: BIO *bio; - /* Create a BIO to wrap the socket*/ + /* Create a BIO to wrap the socket */ bio = BIO_new(BIO_s_socket()); - if (bio == NULL) + if (bio == NULL) { BIO_closesocket(sock); + return NULL; + } /* * Associate the newly created BIO with the underlying socket. By -- cgit v1.2.3