summaryrefslogtreecommitdiffstats
path: root/src/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/hash.c')
-rw-r--r--src/hash.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/hash.c b/src/hash.c
index 9090bad..cc17492 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -44,8 +44,10 @@ usho do_hash_file(const char *filename, const char *type)
do {
ret = fread(&buf, 1, BSIZE, fd);
- if (ret == -1)
+ if (ret == -1) {
+ fclose(fd);
return 0;
+ }
hash ^= do_hash((usho *)&buf, ret);
} while(ret);