[Scummvm-cvs-logs] SF.net SVN: scummvm:[49007] scummvm/trunk/engines/sci/engine/savegame.cpp
m_kiewitz at users.sourceforge.net
m_kiewitz at users.sourceforge.net
Tue May 11 18:16:49 CEST 2010
Revision: 49007
http://scummvm.svn.sourceforge.net/scummvm/?rev=49007&view=rev
Author: m_kiewitz
Date: 2010-05-11 16:16:49 +0000 (Tue, 11 May 2010)
Log Message:
-----------
SCI: fix crash/heap issue when saving games (change was actually made by waltervn)
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/savegame.cpp
Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp 2010-05-11 16:15:21 UTC (rev 49006)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp 2010-05-11 16:16:49 UTC (rev 49007)
@@ -587,9 +587,13 @@
tmp = obj._value;
s.syncString(tmp);
if (s.isLoading()) {
- //free(*str);
- obj._value = (char *)calloc(obj._maxSize, sizeof(char));
- strncpy(obj._value, tmp.c_str(), obj._maxSize);
+ if (!obj._maxSize) {
+ obj._value = NULL;
+ } else {
+ //free(*str);
+ obj._value = (char *)calloc(obj._maxSize, sizeof(char));
+ strncpy(obj._value, tmp.c_str(), obj._maxSize);
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list