Skip to content

Commit

Permalink
vtls: fix socket check conditions
Browse files Browse the repository at this point in the history
fix condition to check the second socket during associate and
disassociate connection

Closes #8493
  • Loading branch information
MAntoniak authored and bagder committed Feb 22, 2022
1 parent 999c217 commit e9e7962
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/vtls/vtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,8 @@ void Curl_ssl_associate_conn(struct Curl_easy *data,
{
if(Curl_ssl->associate_connection) {
Curl_ssl->associate_connection(data, conn, FIRSTSOCKET);
if(conn->sock[SECONDARYSOCKET] && conn->bits.sock_accepted)
if((conn->sock[SECONDARYSOCKET] != CURL_SOCKET_BAD) &&
conn->bits.sock_accepted)
Curl_ssl->associate_connection(data, conn, SECONDARYSOCKET);
}
}
Expand All @@ -640,7 +641,8 @@ void Curl_ssl_detach_conn(struct Curl_easy *data,
{
if(Curl_ssl->disassociate_connection) {
Curl_ssl->disassociate_connection(data, FIRSTSOCKET);
if(conn->sock[SECONDARYSOCKET] && conn->bits.sock_accepted)
if((conn->sock[SECONDARYSOCKET] != CURL_SOCKET_BAD) &&
conn->bits.sock_accepted)
Curl_ssl->disassociate_connection(data, SECONDARYSOCKET);
}
}
Expand Down

0 comments on commit e9e7962

Please sign in to comment.