tool_operate: reorder code to avoid compiler warning

tool_operate.c(889) : warning C4701: potentially uninitialized local
variable 'per' use

Follow-up to cc71d35265
Reported-by: Marc Hörsken
Bug: https://github.com/curl/curl/pull/7922#issuecomment-963042676
Closes #7971
This commit is contained in:
Daniel Stenberg 2021-11-08 12:46:44 +01:00
parent 5c1e1d9aa4
commit 351b181740
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -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 */