summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJay Satiro <raysatiro@yahoo.com>2023-02-18 16:06:11 -0500
committerJay Satiro <raysatiro@yahoo.com>2023-02-18 19:02:40 -0500
commit41dfb7f516c8a9659782df695528c9d32b5653d6 (patch)
treed82d678ac7c14b598d29afb33fd9c6728f992e5d /src
parentcab040248d3fba3600825d77d56383019066b447 (diff)
downloadcurl-41dfb7f516c8a9659782df695528c9d32b5653d6.tar.gz
tool_operate: fix scanbuild compiler warning
Prior to this change Azure CI scanbuild warned of a potential NULL pointer string passed to strtol when CURLDEBUG enabled, even though the way the code was written it wouldn't have happened. Bug: https://github.com/curl/curl/commit/5479d991#r101159711 Reported-by: Marcel Raad Closes https://github.com/curl/curl/pull/10559
Diffstat (limited to 'src')
-rw-r--r--src/tool_operate.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 8bd094885..195159229 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -1301,15 +1301,16 @@ static CURLcode single_transfer(struct GlobalConfig *global,
my_setopt(curl, CURLOPT_SEEKDATA, input);
my_setopt(curl, CURLOPT_SEEKFUNCTION, tool_seek_cb);
+ {
#ifdef CURLDEBUG
- if(getenv("CURL_BUFFERSIZE")) {
- long size = strtol(getenv("CURL_BUFFERSIZE"), NULL, 10);
- if(size)
- my_setopt(curl, CURLOPT_BUFFERSIZE, size);
- }
- else
+ char *env = getenv("CURL_BUFFERSIZE");
+ if(env) {
+ long size = strtol(env, NULL, 10);
+ if(size)
+ my_setopt(curl, CURLOPT_BUFFERSIZE, size);
+ }
+ else
#endif
- {
if(config->recvpersecond &&
(config->recvpersecond < BUFFER_SIZE))
/* use a smaller sized buffer for better sleeps */