From: Dimitris Panokostas Date: Fri, 16 Dec 2022 08:10:39 +0000 (+0100) Subject: bugfix: loop for ortgmem_type should be for the number of MAX_RTG_BOARDS X-Git-Tag: 41010~53^2^2 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=ab4acb584573d0d5da0f4dadba2c5c2d516f6bc4;p=francis%2Fwinuae.git bugfix: loop for ortgmem_type should be for the number of MAX_RTG_BOARDS ortgmem_type is defined having a size of MAX_RTG_BOARDS, but the loop uses MAX_RAM_BOARDS when going through it. Since MAX_RAM_BOARDS and MAX_RTG_BOARDS happen to be the same (4) in WinUAE, it didn't have any effect. However, if those happen to be different (like in Amiberry, where MAX_RTG_BOARDS is set to 1), then this will cause undefined behavior after the first iteration. --- diff --git a/od-win32/mman.cpp b/od-win32/mman.cpp index 64eb6d4d..d1d14a82 100644 --- a/od-win32/mman.cpp +++ b/od-win32/mman.cpp @@ -614,7 +614,7 @@ void free_shm (void) { resetmem (true); clear_shm (); - for (int i = 0; i < MAX_RAM_BOARDS; i++) { + for (int i = 0; i < MAX_RTG_BOARDS; i++) { ortgmem_type[i] = -1; } }