Skip to content

Commit

Permalink
fixed error that do not close the file handle
Browse files Browse the repository at this point in the history
  • Loading branch information
GangZhuo committed Apr 26, 2014
1 parent 6081e97 commit 6892639
Show file tree
Hide file tree
Showing 2 changed files with 175 additions and 143 deletions.
5 changes: 3 additions & 2 deletions pcs/pcs_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ PCS_API const char *md5_string(const char *str)
int i;
MD5((const unsigned char*)str, strlen(str), md);
for (i = 0; i<16; i++){
sprintf(&tmp[i * 2], "%02x", 0xFF & md[i]);
sprintf(&tmp[i * 2], "%02x", md[i]);
}
return tmp;
}
Expand All @@ -211,8 +211,9 @@ PCS_API const char *md5_file(const char *file_name)
while (length = fread(buffer, 1, 1024, file))
MD5_Update(&md5, buffer, length);
MD5_Final(md, &md5);
fclose(file);
for (i = 0; i<16; i++){
sprintf(&tmp[i * 2], "%02x", 0xFF & md[i]);
sprintf(&tmp[i * 2], "%02x", md[i]);
}
return tmp;
}
Loading

0 comments on commit 6892639

Please sign in to comment.