1
0
mirror of https://github.com/moparisthebest/curl synced 2025-01-10 13:38:04 -05:00

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.
This commit is contained in:
Yang Tse 2011-10-22 14:46:49 +02:00
parent d7934b8bd4
commit cc76bbe79b

View File

@ -1208,13 +1208,14 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
retry_sleep = retry_sleep_default; /* ms */ retry_sleep = retry_sleep_default; /* ms */
retrystart = tvnow(); retrystart = tvnow();
for(;;) {
res = curl_easy_perform(curl);
if(!curl_slist_append(easysrc, "ret = curl_easy_perform(hnd);")) { if(!curl_slist_append(easysrc, "ret = curl_easy_perform(hnd);")) {
res = CURLE_OUT_OF_MEMORY; res = CURLE_OUT_OF_MEMORY;
goto show_error; goto show_error;
} }
for(;;) {
res = curl_easy_perform(curl);
if(config->content_disposition && outs.stream && !config->mute && if(config->content_disposition && outs.stream && !config->mute &&
outs.filename) outs.filename)
printf("curl: Saved to filename '%s'\n", outs.filename); printf("curl: Saved to filename '%s'\n", outs.filename);