If the formatting fails, we error out on a fatal error and
clean up on the way out. The array was however freed within
the wrong scope and was thus never freed in case the cookies
were written to a file instead of STDOUT.
Closes #2957
format_ptr = get_netscape_format(array[i]);
if(format_ptr == NULL) {
fprintf(out, "#\n# Fatal libcurl error\n");
- if(!use_stdout) {
- free(array);
+ free(array);
+ if(!use_stdout)
fclose(out);
- }
return 1;
}
fprintf(out, "%s\n", format_ptr);