mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Fixed momory leak in RsDirUtil::getFileHash when the file doesn't exist.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8450 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
7563cb02d0
commit
87758c4043
@ -646,14 +646,15 @@ bool RsDirUtil::hashFile(const std::string& filepath,
|
||||
bool RsDirUtil::getFileHash(const std::string& filepath, RsFileHash &hash, uint64_t &size, RsThread *thread /*= NULL*/)
|
||||
{
|
||||
FILE *fd;
|
||||
|
||||
if (NULL == (fd = RsDirUtil::rs_fopen(filepath.c_str(), "rb")))
|
||||
return false;
|
||||
|
||||
int len;
|
||||
SHA_CTX *sha_ctx = new SHA_CTX;
|
||||
unsigned char sha_buf[SHA_DIGEST_LENGTH];
|
||||
unsigned char gblBuf[512];
|
||||
|
||||
if (NULL == (fd = RsDirUtil::rs_fopen(filepath.c_str(), "rb")))
|
||||
return false;
|
||||
|
||||
/* determine size */
|
||||
fseeko64(fd, 0, SEEK_END);
|
||||
size = ftello64(fd);
|
||||
|
Loading…
Reference in New Issue
Block a user