[Scummvm-cvs-logs] scummvm master -> 2a883bdd424a166215eeeecf6876ac1cc30fb8bd

m-kiewitz m_kiewitz at users.sourceforge.net
Mon Feb 8 20:49:58 CET 2016


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:
2a883bdd42 SCI: Zero out dynamically allocated memory


Commit: 2a883bdd424a166215eeeecf6876ac1cc30fb8bd
    https://github.com/scummvm/scummvm/commit/2a883bdd424a166215eeeecf6876ac1cc30fb8bd
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2016-02-08T20:49:22+01:00

Commit Message:
SCI: Zero out dynamically allocated memory

Fixes Mixed Up Mother Goose SCI1.1 crash when saving
And could potentially fix all sorts of other issues
Original SCI only zeroed out heap on init.

Changed paths:
    engines/sci/engine/seg_manager.cpp



diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index 23b1fda..8090b18 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -837,10 +837,13 @@ byte *SegManager::allocDynmem(int size, const char *descr, reg_t *addr) {
 
 	d._size = size;
 
-	if (size == 0)
+	// Original SCI only zeroed out heap memory on initialize
+	// They didn't do it again for every allocation
+	if (size) {
+		d._buf = (byte *)calloc(size, 1);
+	} else {
 		d._buf = NULL;
-	else
-		d._buf = (byte *)malloc(size);
+	}
 
 	d._description = descr;
 






More information about the Scummvm-git-logs mailing list