From cc76bbe79b405f2c2c01155f18cca1491e084d5c Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Sat, 22 Oct 2011 14:46:49 +0200 Subject: tool_operate.c: OOM handling fix Move curl_easy_perform source code geneartion out of curl_easy_perform's loop for proper OOM handling and source code geneartion. --- src/tool_operate.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/tool_operate.c b/src/tool_operate.c index 65f4b60b8..7ab815f83 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -1208,12 +1208,13 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[]) retry_sleep = retry_sleep_default; /* ms */ retrystart = tvnow(); + if(!curl_slist_append(easysrc, "ret = curl_easy_perform(hnd);")) { + res = CURLE_OUT_OF_MEMORY; + goto show_error; + } + for(;;) { res = curl_easy_perform(curl); - if(!curl_slist_append(easysrc, "ret = curl_easy_perform(hnd);")) { - res = CURLE_OUT_OF_MEMORY; - goto show_error; - } if(config->content_disposition && outs.stream && !config->mute && outs.filename) -- cgit v1.2.3