]> granicus.if.org Git - curl/commitdiff
tool_getparam: fix memory leak on test 1147 OOM (torture tests)
authorJay Satiro <raysatiro@yahoo.com>
Mon, 26 Jun 2017 05:03:12 +0000 (01:03 -0400)
committerJay Satiro <raysatiro@yahoo.com>
Mon, 26 Jun 2017 05:05:02 +0000 (01:05 -0400)
Bug: https://github.com/curl/curl/pull/1486#issuecomment-310926872
Reported-by: Dan Fandrich
src/tool_getparam.c

index 6cb394139d42b9a3949833bd218fb5e748081da1..f64208a2b4731b3e6b198f6cd3b2d57fdac19b45 100644 (file)
@@ -1626,13 +1626,15 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
               else
                 err = add2list(&config->headers, h);
               if(err)
-                return err;
+                break;
               h = strtok(NULL, "\r\n");
             }
             free(string);
           }
           if(!use_stdin)
             fclose(file);
+          if(err)
+            return err;
         }
       }
       else {