TONY: Fix memory leak on save game failure (CID 1003579)

Though shouldn't it also alert the user to the failure?
This commit is contained in:
Torbjörn Andersson 2013-06-02 22:13:59 +02:00
parent 9d28a6f531
commit 1cc0e9cb88

View File

@ -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();
@ -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);