Commit cc76bbe7 authored by Yang Tse's avatar Yang Tse
Browse files

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.
parent d7934b8b
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -1208,13 +1208,14 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
        retry_sleep = retry_sleep_default; /* ms */
        retrystart = tvnow();

        for(;;) {
          res = curl_easy_perform(curl);
        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(config->content_disposition && outs.stream && !config->mute &&
             outs.filename)
            printf("curl: Saved to filename '%s'\n", outs.filename);