md5_file: fclose() if error

This commit is contained in:
David Anderson 2014-06-27 13:38:16 -07:00
parent 284b07e340
commit 5cc3bb5e41
1 changed files with 2 additions and 0 deletions

View File

@ -70,9 +70,11 @@ int md5_file(const char* path, char* output, double& nbytes, bool is_gzip) {
if (is_gzip) {
n = (int)fread(buf, 1, 10, f);
if (n != 10) {
fclose(f);
return ERR_BAD_FORMAT;
}
if (buf[0] != 0x1f || buf[1] != 0x8b || buf[2] != 0x08) {
fclose(f);
return ERR_BAD_FORMAT;
}
nbytes = 10;