diff options
author | Nick White <hg@njw.me.uk> | 2011-07-16 15:14:16 +0100 |
---|---|---|
committer | Nick White <hg@njw.me.uk> | 2011-07-16 15:14:16 +0100 |
commit | 5e8f9f92a2bc1eb1665fdb902afe1111c864b7b5 (patch) | |
tree | 53ff8400f33e759c62a2f980e9c581a2eda2bd9d /util.c | |
parent | 4d6350f4adef68ddb9aeb8a19c81ff7bbbffba98 (diff) |
Tighten memory usage
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -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); |