summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/util.c b/util.c
index 8d0fa8c..1017b1b 100644
--- a/util.c
+++ b/util.c
@@ -71,14 +71,13 @@ int gettofile(char *url, char *savepath) {
}
if((f = fopen(savepath, "w")) == NULL) {
fprintf(stderr, "Could not create file %s\n", savepath);
- return 1;
+ free(buf); return 1;
}
for(i=0; i < l; i+=512)
if(!fwrite(buf+i, l-i > 512 ? 512 : l-i, 1, f)) {
fprintf(stderr, "Error writing file %s\n", savepath);
- free(buf); fclose(f);
- return 1;
+ free(buf); fclose(f); return 1;
}
free(buf);