Skip to content

Commit 2b2a60b

Browse files
author
nitrocaster
committed
Fix memory leak in render resource managers.
1 parent e5125da commit 2b2a60b

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/Layers/xrRenderDX10/dx10ResourceManager_Resources.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,9 @@ SPS* CResourceManager::_CreatePS (LPCSTR _name)
268268
FS.update_path (cname, "$game_shaders$", cname);
269269

270270
// duplicate and zero-terminate
271-
IReader* R = FS.r_open(cname);
271+
IReader *file = FS.r_open(cname);
272272
// TODO: DX10: HACK: Implement all shaders. Remove this for PS
273-
if (!R)
273+
if (!file)
274274
{
275275
string1024 tmp;
276276
// TODO: HACK: Test failure
@@ -279,10 +279,8 @@ SPS* CResourceManager::_CreatePS (LPCSTR _name)
279279
Msg (tmp);
280280
strconcat (sizeof(cname), cname,GlobalEnv.Render->getShaderPath(),"stub_default",".ps");
281281
FS.update_path (cname, "$game_shaders$", cname);
282-
R = FS.r_open(cname);
282+
file = FS.r_open(cname);
283283
}
284-
285-
IReader* file = FS.r_open(cname);
286284
R_ASSERT2 ( file, cname );
287285
u32 const size = file->length();
288286
char* const data = (LPSTR)_alloca(size + 1);

src/Layers/xrRenderPC_GL/glResourceManager_Resources.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,9 @@ SGS* CResourceManager::_CreateGS (LPCSTR name)
358358
FS.update_path (cname, "$game_shaders$", cname);
359359

360360
// duplicate and zero-terminate
361-
IReader* R = FS.r_open(cname);
361+
IReader *file = FS.r_open(cname);
362362
// TODO: DX10: HACK: Implement all shaders. Remove this for PS
363-
if (!R)
363+
if (!file)
364364
{
365365
string1024 tmp;
366366
// TODO: HACK: Test failure
@@ -369,9 +369,8 @@ SGS* CResourceManager::_CreateGS (LPCSTR name)
369369
Msg (tmp);
370370
strconcat (sizeof(cname), cname,GlobalEnv.Render->getShaderPath(),"stub_default",".gs");
371371
FS.update_path (cname, "$game_shaders$", cname);
372-
R = FS.r_open(cname);
372+
file = FS.r_open(cname);
373373
}
374-
IReader* file = FS.r_open(cname);
375374
R_ASSERT2 ( file, cname );
376375

377376
// Select target

0 commit comments

Comments
 (0)