summaryrefslogtreecommitdiffstats
path: root/Source/CTest
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2022-05-21 21:22:01 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2022-05-21 21:23:19 (GMT)
commit97220f5b3f8b8c744466668c9689168953843594 (patch)
treecad18bde58031d5360e8b8432ff13266b20f9a8b /Source/CTest
parent13ab9fbf36165f707dd5e7dbeebc4e964fc8aefa (diff)
downloadCMake-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.cxx8
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;