Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix a potential memory leak on non-windows systems.
Also added a FIXME to BPStructs.cpp and BPMemLoader.cpp
  • Loading branch information
lioncash committed Jan 24, 2013
1 parent f69b6b5 commit 2db0c42
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Source/Core/Common/Src/FileUtil.cpp
Expand Up @@ -512,12 +512,24 @@ bool DeleteDirRecursively(const std::string &directory)
if (IsDirectory(newPath))
{
if (!DeleteDirRecursively(newPath))
{
#ifndef _WIN32
closedir(dirp);
#endif

return false;
}
}
else
{
if (!File::Delete(newPath))
{
#ifndef _WIN32
closedir(dirp);
#endif

return false;
}
}

#ifdef _WIN32
Expand Down
1 change: 1 addition & 0 deletions Source/Core/VideoCommon/Src/BPStructs.cpp
Expand Up @@ -519,6 +519,7 @@ void BPWritten(const BPCmd& bp)

for (u32 i = 0; i < tmem_cfg.preload_tile_info.count; ++i)
{
// FIXME: Duplicate conditions.
if (tmem_addr_even + TMEM_LINE_SIZE > TMEM_SIZE ||
tmem_addr_even + TMEM_LINE_SIZE > TMEM_SIZE)
break;
Expand Down
1 change: 1 addition & 0 deletions Source/Plugins/Plugin_VideoSoftware/Src/BPMemLoader.cpp
Expand Up @@ -137,6 +137,7 @@ void SWBPWritten(int address, int newvalue)

for (int i = 0; i < tmem_cfg.preload_tile_info.count; ++i)
{
// FIXME: Duplicate conditions
if (tmem_addr_even + TMEM_LINE_SIZE > TMEM_SIZE ||
tmem_addr_even + TMEM_LINE_SIZE > TMEM_SIZE)
break;
Expand Down

0 comments on commit 2db0c42

Please sign in to comment.