Skip to content

Commit

Permalink
TONY: Fix memory leak on save game failure (CID 1003579)
Browse files Browse the repository at this point in the history
Though shouldn't it also alert the user to the failure?
  • Loading branch information
Torbjörn Andersson committed Jun 2, 2013
1 parent 9d28a6f commit 1cc0e9c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions engines/tony/gfxengine.cpp
Expand Up @@ -530,7 +530,10 @@ void RMGfxEngine::disableMouse() {
#define TONY_SAVEGAME_VERSION 8

void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Common::String &name) {
Common::OutSaveFile *f;
Common::OutSaveFile *f = g_system->getSavefileManager()->openForSaving(fn);
if (f == NULL)
return;

byte *state;
char buf[4];
RMPoint tp = _tony.position();
Expand All @@ -549,10 +552,6 @@ void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Comm
buf[2] = 'S';
buf[3] = TONY_SAVEGAME_VERSION;

f = g_system->getSavefileManager()->openForSaving(fn);
if (f == NULL)
return;

f->write(buf, 4);
f->writeUint32LE(thumbsize);
f->write(curThumb, thumbsize);
Expand Down

0 comments on commit 1cc0e9c

Please sign in to comment.