aboutsummaryrefslogtreecommitdiff
path: root/docs/examples/fileupload.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2016-11-08 23:00:43 +0100
committerDaniel Stenberg <daniel@haxx.se>2016-11-08 23:00:43 +0100
commitdfcdaaba371e9a33fdf1785a29fb09b7ed955b59 (patch)
treebe774449984f895c2585c59e66044936ba219a06 /docs/examples/fileupload.c
parent5dd1b65f79bc6dc75b752c53f3fa853b2a3b6d69 (diff)
downloadgnurl-dfcdaaba371e9a33fdf1785a29fb09b7ed955b59.tar.gz
gnurl-dfcdaaba371e9a33fdf1785a29fb09b7ed955b59.tar.bz2
gnurl-dfcdaaba371e9a33fdf1785a29fb09b7ed955b59.zip
examples/fileupload.c: fclose the file as well
Diffstat (limited to 'docs/examples/fileupload.c')
-rw-r--r--docs/examples/fileupload.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/docs/examples/fileupload.c b/docs/examples/fileupload.c
index 363fae694..6b05c4cec 100644
--- a/docs/examples/fileupload.c
+++ b/docs/examples/fileupload.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -37,16 +37,12 @@ int main(void)
FILE *fd;
fd = fopen("debugit", "rb"); /* open file to upload */
- if(!fd) {
-
+ if(!fd)
return 1; /* can't continue */
- }
/* to get the file size */
- if(fstat(fileno(fd), &file_info) != 0) {
-
+ if(fstat(fileno(fd), &file_info) != 0)
return 1; /* can't continue */
- }
curl = curl_easy_init();
if(curl) {
@@ -86,5 +82,6 @@ int main(void)
/* always cleanup */
curl_easy_cleanup(curl);
}
+ fclose(fd);
return 0;
}