Skip to content

Commit

Permalink
Fixed: Cleaned up p_saveio init and shutdown
Browse files Browse the repository at this point in the history
savefile was not always closed in the appropriate manner, leaving
a pointer to freed memory.
  • Loading branch information
skyjake committed Jan 10, 2012
1 parent f736888 commit 0915fd4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions doomsday/plugins/common/src/p_saveg.c
Expand Up @@ -4499,11 +4499,12 @@ void SV_Init(void)
{
static boolean firstInit = true;

SV_InitIO();

inited = true;
if(firstInit)
{
firstInit = false;
SV_InitIO();
playerHeaderOK = false;
thingArchive = NULL;
thingArchiveSize = 0;
Expand All @@ -4514,7 +4515,6 @@ void SV_Init(void)
#else
numSoundTargets = 0;
#endif

// -1 = Not yet chosen/determined.
cvarQuickSlot = -1;
}
Expand Down Expand Up @@ -4735,7 +4735,7 @@ static boolean SV_LoadGame2(void)
#endif

#if !__JHEXEN__
lzClose(SV_File());
SV_CloseFile();
#endif

// We are done with the MaterialArchive.
Expand Down
3 changes: 3 additions & 0 deletions doomsday/plugins/common/src/p_saveio.c
Expand Up @@ -63,12 +63,15 @@ void SV_InitIO(void)
#endif
gameSaveInfo = NULL;
inited = true;
savefile = 0;
}

void SV_ShutdownIO(void)
{
inited = false;

SV_CloseFile();

if(gameSaveInfo)
{
int i;
Expand Down

0 comments on commit 0915fd4

Please sign in to comment.