cmcurl: Fix resource leak reported by cppcheck

Add missing fclose calls.

Reviewed-by: Igor Murzov <e-mail@date.by>
This commit is contained in:
Ömer Fadıl USTA 2013-07-12 17:23:55 +03:00 committed by Brad King
parent 499531c64e
commit c8adab9e43
3 changed files with 6 additions and 0 deletions

View File

@ -56,6 +56,7 @@ int main(int argc, char **argv)
bodyfile = fopen(bodyfilename,"w");
if (bodyfile == NULL) {
curl_easy_cleanup(curl_handle);
fclose(headerfile);
return -1;
}
@ -70,6 +71,7 @@ int main(int argc, char **argv)
/* close the header file */
fclose(headerfile);
fclose(bodyfile);
/* cleanup curl stuff */
curl_easy_cleanup(curl_handle);

View File

@ -114,5 +114,7 @@ int main(int argc, char **argv)
curl_global_cleanup();
if (headerfile)
fclose(headerfile);
return 0;
}

View File

@ -969,6 +969,8 @@ 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");
if(!use_stdout)
fclose(out);
return 1;
}
fprintf(out, "%s\n", format_ptr);