diff options
author | Joost Peters | 2008-12-24 16:10:55 +0000 |
---|---|---|
committer | Joost Peters | 2008-12-24 16:10:55 +0000 |
commit | 85bfce72d306df155dbbd79a20aac7ca0f4595fb (patch) | |
tree | 6961887bc4d2bbe06ba7e8e4744de8959b0d0505 | |
parent | 74024ff3e52804b0247364a5dfeff2e9520e48f8 (diff) | |
download | scummvm-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
-rw-r--r-- | engines/tinsel/heapmem.cpp | 4 |
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 |