diff --git a/lib/cookie.c b/lib/cookie.c index 4a33845ab7a027a5b72bc63b9a57800581a6ba60..e64bc49e9c619016f60b9919ced87f980f14150b 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -972,6 +972,7 @@ int Curl_cookie_output(struct CookieInfo *c, char *dumphere) format_ptr = get_netscape_format(co); if (format_ptr == NULL) { fprintf(out, "#\n# Fatal libcurl error\n"); + fclose(out); return 1; } fprintf(out, "%s\n", format_ptr);