diff options
author | Daniel Stenberg <daniel@haxx.se> | 2021-11-08 12:46:44 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2021-11-08 16:51:01 +0100 |
commit | 351b1817401f91e168517f87106f6cf495288c88 (patch) | |
tree | 6475a75536632aca4f57de27ddfc6ca441097f0f /src | |
parent | 5c1e1d9aa46302b0f9999f088ba87e10a9779254 (diff) | |
download | curl-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
Diffstat (limited to 'src')
-rw-r--r-- | src/tool_operate.c | 7 |
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 */ |