summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-11-08 12:46:44 +0100
committerDaniel Stenberg <daniel@haxx.se>2021-11-08 16:51:01 +0100
commit351b1817401f91e168517f87106f6cf495288c88 (patch)
tree6475a75536632aca4f57de27ddfc6ca441097f0f
parent5c1e1d9aa46302b0f9999f088ba87e10a9779254 (diff)
downloadcurl-351b1817401f91e168517f87106f6cf495288c88.tar.gz
tool_operate: reorder code to avoid compiler warning
tool_operate.c(889) : warning C4701: potentially uninitialized local variable 'per' use Follow-up to cc71d352651a0d95 Reported-by: Marc Hörsken Bug: https://github.com/curl/curl/pull/7922#issuecomment-963042676 Closes #7971
-rw-r--r--src/tool_operate.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tool_operate.c b/src/tool_operate.c
index f92b1bd37..ed3b2f56a 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -794,7 +794,7 @@ static CURLcode single_transfer(struct GlobalConfig *global,
!strcmp(state->outfiles, "-")) && urlnum > 1);
if(state->up < state->infilenum) {
- struct per_transfer *per;
+ struct per_transfer *per = NULL;
struct OutStruct *outs;
struct InStruct *input;
struct OutStruct *heads;
@@ -879,11 +879,12 @@ static CURLcode single_transfer(struct GlobalConfig *global,
curl = curl_easy_init();
if(curl)
result = add_per_transfer(&per);
- if(result || !curl) {
+ else
+ result = CURLE_OUT_OF_MEMORY;
+ if(result) {
curl_easy_cleanup(curl);
if(etag_save->fopened)
fclose(etag_save->stream);
- result = CURLE_OUT_OF_MEMORY;
break;
}
per->etag_save = etag_first; /* copy the whole struct */