mirror of
https://github.com/openssl/openssl.git
synced 2024-11-21 01:15:20 +08:00
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)
This commit is contained in:
parent
cdedecd503
commit
11b7d46fa7
@ -89,10 +89,12 @@ static BIO *create_socket_bio(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
|
||||
|
@ -90,10 +90,12 @@ static BIO *create_socket_bio(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
|
||||
|
@ -90,11 +90,12 @@ static BIO *create_socket_bio(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
|
||||
* passing BIO_CLOSE here the socket will be automatically closed when
|
||||
|
@ -76,8 +76,10 @@ static BIO *create_socket_bio(const char *hostname, const char *port)
|
||||
|
||||
/* 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
|
||||
|
@ -81,10 +81,12 @@ static BIO *create_socket_bio(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_socket());
|
||||
if (bio == NULL)
|
||||
if (bio == NULL) {
|
||||
BIO_closesocket(sock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Associate the newly created BIO with the underlying socket. By
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user