diff options
author | Matt Caswell <matt@openssl.org> | 2023-09-06 13:36:43 +0200 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2023-09-08 16:44:37 +0200 |
commit | 11b7d46fa7e2684e0ad0f12a7806163dba99983d (patch) | |
tree | f2349dd688bad7b70a1d907c6e3a9c568d2c223f /util | |
parent | Add a missing call to BIO_closesocket() (diff) | |
download | openssl-11b7d46fa7e2684e0ad0f12a7806163dba99983d.tar.xz openssl-11b7d46fa7e2684e0ad0f12a7806163dba99983d.zip |
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 <tomas@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21950)
Diffstat (limited to 'util')
-rw-r--r-- | util/quicserver.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/util/quicserver.c b/util/quicserver.c index 5a51b240ff..fd9f9399bd 100644 --- a/util/quicserver.c +++ b/util/quicserver.c @@ -113,10 +113,12 @@ static BIO *create_dgram_bio(int family, const char *hostname, const char *port) if (sock == -1) return NULL; - /* 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 |