diff options
author | Ömer Fadıl USTA <omerusta@gmail.com> | 2013-07-12 14:23:55 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-07-15 14:20:00 (GMT) |
commit | c8adab9e4344a5ef96d902cf11c938d15aff15fc (patch) | |
tree | 29bcb489aa5814fecd699de7990aa71899502771 /Utilities | |
parent | 499531c64e0cd3a6834616af576d612e8678e4d9 (diff) | |
download | CMake-c8adab9e4344a5ef96d902cf11c938d15aff15fc.zip CMake-c8adab9e4344a5ef96d902cf11c938d15aff15fc.tar.gz CMake-c8adab9e4344a5ef96d902cf11c938d15aff15fc.tar.bz2 |
cmcurl: Fix resource leak reported by cppcheck
Add missing fclose calls.
Reviewed-by: Igor Murzov <e-mail@date.by>
Diffstat (limited to 'Utilities')
-rw-r--r-- | Utilities/cmcurl/Testing/sepheaders.c | 2 | ||||
-rw-r--r-- | Utilities/cmcurl/Testing/simplessl.c | 2 | ||||
-rw-r--r-- | Utilities/cmcurl/cookie.c | 2 |
3 files changed, 6 insertions, 0 deletions
diff --git a/Utilities/cmcurl/Testing/sepheaders.c b/Utilities/cmcurl/Testing/sepheaders.c index 8185787..fc5b783 100644 --- a/Utilities/cmcurl/Testing/sepheaders.c +++ b/Utilities/cmcurl/Testing/sepheaders.c @@ -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); diff --git a/Utilities/cmcurl/Testing/simplessl.c b/Utilities/cmcurl/Testing/simplessl.c index 9a53603..e307eaa 100644 --- a/Utilities/cmcurl/Testing/simplessl.c +++ b/Utilities/cmcurl/Testing/simplessl.c @@ -114,5 +114,7 @@ int main(int argc, char **argv) curl_global_cleanup(); + if (headerfile) + fclose(headerfile); return 0; } diff --git a/Utilities/cmcurl/cookie.c b/Utilities/cmcurl/cookie.c index 2856ad8..d8ea241 100644 --- a/Utilities/cmcurl/cookie.c +++ b/Utilities/cmcurl/cookie.c @@ -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); |