diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2022-05-21 21:22:01 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2022-05-21 21:23:19 (GMT) |
commit | 97220f5b3f8b8c744466668c9689168953843594 (patch) | |
tree | cad18bde58031d5360e8b8432ff13266b20f9a8b /Source/CTest | |
parent | 13ab9fbf36165f707dd5e7dbeebc4e964fc8aefa (diff) | |
download | CMake-97220f5b3f8b8c744466668c9689168953843594.zip CMake-97220f5b3f8b8c744466668c9689168953843594.tar.gz CMake-97220f5b3f8b8c744466668c9689168953843594.tar.bz2 |
cmCTestSubmitHandler: avoid double fetching envvars
Technically, they can change between these two calls, so use the
verified pointer to assign to strings. Discovered by `clang-analyzer`.
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index baeafc1..a8e0652 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -730,15 +730,15 @@ int cmCTestSubmitHandler::ProcessHandler() return -1; } - if (getenv("HTTP_PROXY")) { + if (char const* proxy = getenv("HTTP_PROXY")) { this->HTTPProxyType = 1; - this->HTTPProxy = getenv("HTTP_PROXY"); + this->HTTPProxy = proxy; if (getenv("HTTP_PROXY_PORT")) { this->HTTPProxy += ":"; this->HTTPProxy += getenv("HTTP_PROXY_PORT"); } - if (getenv("HTTP_PROXY_TYPE")) { - std::string type = getenv("HTTP_PROXY_TYPE"); + if (char const* proxy_type = getenv("HTTP_PROXY_TYPE")) { + std::string type = proxy_type; // HTTP/SOCKS4/SOCKS5 if (type == "HTTP") { this->HTTPProxyType = 1; |