[Scummvm-cvs-logs] scummvm master -> 1cc0e9cb8813a39c9f9d95287b811dbb534e3868

eriktorbjorn eriktorbjorn at telia.com
Sun Jun 2 22:15:58 CEST 2013


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

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


Commit: 1cc0e9cb8813a39c9f9d95287b811dbb534e3868
    https://github.com/scummvm/scummvm/commit/1cc0e9cb8813a39c9f9d95287b811dbb534e3868
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2013-06-02T13:13:59-07:00

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

Though shouldn't it also alert the user to the failure?

Changed paths:
    engines/tony/gfxengine.cpp



diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp
index cb27e20..7bb25f5 100644
--- a/engines/tony/gfxengine.cpp
+++ b/engines/tony/gfxengine.cpp
@@ -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);






More information about the Scummvm-git-logs mailing list