From 351b1817401f91e168517f87106f6cf495288c88 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 8 Nov 2021 12:46:44 +0100 Subject: tool_operate: reorder code to avoid compiler warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/tool_operate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') 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 */ -- cgit v1.2.1