Fixed possible fread from a null pointer in HashCache.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8476 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2015-06-15 21:40:34 +00:00
parent 25acecdf93
commit b6e0f7c5a4

View File

@ -136,7 +136,12 @@ HashCache::HashCache(const std::string& path)
return ;
}
FILE *F = fopen( (_path+".bin").c_str(),"rb") ;
if (!F)
{
std::cerr << "Cannot open file for reading encrypted file cache, filename " << (_path+".bin") << std::endl;
free(buffer);
return;
}
if(fread(buffer,1,file_size,F) != file_size)
{
std::cerr << "Cannot read from file " + _path+".bin" << ": something's wrong." << std::endl;