Skip to content

Commit

Permalink
[loadfile] reduce scope of tempinputBuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Marshall authored and Karlson2k committed Jul 23, 2013
1 parent 4d8d64b commit 80189e9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions xbmc/utils/FileUtils.cpp
Expand Up @@ -170,7 +170,6 @@ unsigned int CFileUtils::LoadFile(const std::string &filename, void* &outputBuff
return 0;
}
unsigned int chunksize = (filesize > 0) ? (unsigned int)(filesize + 1) : CFile::GetChunkSize(file.GetChunkSize(), min_chunk_size);
unsigned char *tempinputBuff = NULL;
unsigned char *inputBuff = NULL;
unsigned int inputBuffSize = 0;

Expand All @@ -180,7 +179,9 @@ unsigned int CFileUtils::LoadFile(const std::string &filename, void* &outputBuff
if (!free_space)
{ // (re)alloc
inputBuffSize += chunksize;
tempinputBuff = (unsigned char *)realloc(inputBuff, inputBuffSize);
unsigned char *tempinputBuff = NULL;
if (inputBuffSize <= max_file_size)
tempinputBuff = (unsigned char *)realloc(inputBuff, inputBuffSize);
if (!tempinputBuff)
{
CLog::Log(LOGERROR, "%s unable to allocate buffer of size %u", __FUNCTION__, inputBuffSize);
Expand Down

0 comments on commit 80189e9

Please sign in to comment.