aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJoost Peters2008-12-24 16:10:55 +0000
committerJoost Peters2008-12-24 16:10:55 +0000
commit85bfce72d306df155dbbd79a20aac7ca0f4595fb (patch)
tree6961887bc4d2bbe06ba7e8e4744de8959b0d0505 /engines
parent74024ff3e52804b0247364a5dfeff2e9520e48f8 (diff)
downloadscummvm-rg350-85bfce72d306df155dbbd79a20aac7ca0f4595fb.tar.gz
scummvm-rg350-85bfce72d306df155dbbd79a20aac7ca0f4595fb.tar.bz2
scummvm-rg350-85bfce72d306df155dbbd79a20aac7ca0f4595fb.zip
on systems that need alignment, allocate chunks that are a multiple of 4 to ensure we get aligned chunks.
Otherwise, some pNode structs will be dereferenced from unaligned addresses. svn-id: r35527
Diffstat (limited to 'engines')
-rw-r--r--engines/tinsel/heapmem.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/engines/tinsel/heapmem.cpp b/engines/tinsel/heapmem.cpp
index c06313da20..9e19841562 100644
--- a/engines/tinsel/heapmem.cpp
+++ b/engines/tinsel/heapmem.cpp
@@ -284,6 +284,10 @@ MEM_NODE *MemoryAlloc(int flags, long size) {
HeapCompact(MAX_INT, false);
}
+#ifdef SCUMM_NEED_ALIGNMENT
+ size = (size + 3) & ~3;
+#endif
+
while ((flags & DWM_NOALLOC) == 0 && bCompacted) {
// search the heap for a free block