diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-05-29 13:04:25 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-05-29 13:05:09 +0200 |
commit | 6531d089e514ae723241b7a593ed5f8152900ea7 (patch) | |
tree | a42d18b36a2a09d65c52dec8b5ee38fceabd8a36 /tests | |
parent | 733a39a907381b14196c3763b39a04f174e049a1 (diff) |
server/sws: fix asan warning on use of uninitialized variable
Diffstat (limited to 'tests')
-rw-r--r-- | tests/server/sws.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/server/sws.c b/tests/server/sws.c index 49790f03a..b0f2a83d6 100644 --- a/tests/server/sws.c +++ b/tests/server/sws.c @@ -2206,6 +2206,7 @@ int main(int argc, char *argv[]) fd_set output; struct timeval timeout = {0, 250000L}; /* 250 ms */ curl_socket_t maxfd = (curl_socket_t)-1; + int active; /* Clear out closed sockets */ for(socket_idx = num_sockets - 1; socket_idx >= 1; --socket_idx) { @@ -2253,6 +2254,7 @@ int main(int argc, char *argv[]) /* Timed out - try again */ continue; } + active = rc; /* a positive number */ /* Check if the listening socket is ready to accept */ if(FD_ISSET(all_sockets[0], &input)) { @@ -2264,11 +2266,13 @@ int main(int argc, char *argv[]) if(CURL_SOCKET_BAD == msgsock) goto sws_cleanup; } while(msgsock > 0); + active--; } /* Service all connections that are ready */ - for(socket_idx = 1; socket_idx < num_sockets; ++socket_idx) { + for(socket_idx = 1; (socket_idx < num_sockets) && active; ++socket_idx) { if(FD_ISSET(all_sockets[socket_idx], &input)) { + active--; if(got_exit_signal) goto sws_cleanup; |