aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2010-05-11 16:16:49 +0000
committerMartin Kiewitz2010-05-11 16:16:49 +0000
commitb05694b5299bd294f1f24577a2073d9ffeba924a (patch)
treea15ac5137673ea52849e860e9efc15387b8f982a
parenta5ed93034012eb17e3f756273a86c0c38b0ae200 (diff)
downloadscummvm-rg350-b05694b5299bd294f1f24577a2073d9ffeba924a.tar.gz
scummvm-rg350-b05694b5299bd294f1f24577a2073d9ffeba924a.tar.bz2
scummvm-rg350-b05694b5299bd294f1f24577a2073d9ffeba924a.zip
SCI: fix crash/heap issue when saving games (change was actually made by waltervn)
svn-id: r49007
-rw-r--r--engines/sci/engine/savegame.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 498158ed17..bf251eafcb 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -587,9 +587,13 @@ static void sync_SystemString(Common::Serializer &s, SystemString &obj) {
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);
+ }
}
}