summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/download.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/download.c b/src/download.c
index bd794b1..8fb482a 100644
--- a/src/download.c
+++ b/src/download.c
@@ -103,13 +103,13 @@ int download_to_file(const char* url, const char* filename)
curl_easy_cleanup(handle);
off_t sz = ftello(f);
+ fclose(f);
+
if ((sz == 0) || (sz == (off_t)-1)) {
res = -1;
remove(filename);
}
- fclose(f);
-
curl_global_cleanup();
return res;