Skip to content

Commit

Permalink
Fix memory leak in render resource managers.
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocaster committed Feb 26, 2016
1 parent e5125da commit 2b2a60b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
8 changes: 3 additions & 5 deletions src/Layers/xrRenderDX10/dx10ResourceManager_Resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@ SPS* CResourceManager::_CreatePS (LPCSTR _name)
FS.update_path (cname, "$game_shaders$", cname);

// duplicate and zero-terminate
IReader* R = FS.r_open(cname);
IReader *file = FS.r_open(cname);
// TODO: DX10: HACK: Implement all shaders. Remove this for PS
if (!R)
if (!file)
{
string1024 tmp;
// TODO: HACK: Test failure
Expand All @@ -279,10 +279,8 @@ SPS* CResourceManager::_CreatePS (LPCSTR _name)
Msg (tmp);
strconcat (sizeof(cname), cname,GlobalEnv.Render->getShaderPath(),"stub_default",".ps");
FS.update_path (cname, "$game_shaders$", cname);
R = FS.r_open(cname);
file = FS.r_open(cname);
}

IReader* file = FS.r_open(cname);
R_ASSERT2 ( file, cname );
u32 const size = file->length();
char* const data = (LPSTR)_alloca(size + 1);
Expand Down
7 changes: 3 additions & 4 deletions src/Layers/xrRenderPC_GL/glResourceManager_Resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,9 @@ SGS* CResourceManager::_CreateGS (LPCSTR name)
FS.update_path (cname, "$game_shaders$", cname);

// duplicate and zero-terminate
IReader* R = FS.r_open(cname);
IReader *file = FS.r_open(cname);
// TODO: DX10: HACK: Implement all shaders. Remove this for PS
if (!R)
if (!file)
{
string1024 tmp;
// TODO: HACK: Test failure
Expand All @@ -369,9 +369,8 @@ SGS* CResourceManager::_CreateGS (LPCSTR name)
Msg (tmp);
strconcat (sizeof(cname), cname,GlobalEnv.Render->getShaderPath(),"stub_default",".gs");
FS.update_path (cname, "$game_shaders$", cname);
R = FS.r_open(cname);
file = FS.r_open(cname);
}
IReader* file = FS.r_open(cname);
R_ASSERT2 ( file, cname );

// Select target
Expand Down

0 comments on commit 2b2a60b

Please sign in to comment.