From 87aeed8eb1603f2f3b2309efcbeb52b5c2f3db12 Mon Sep 17 00:00:00 2001 From: bebbo Date: Mon, 11 Apr 2022 14:52:05 +0200 Subject: [PATCH] fix merge after in deallocate --- amitools/vamos/lib/lexec/Alloc.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/amitools/vamos/lib/lexec/Alloc.py b/amitools/vamos/lib/lexec/Alloc.py index 384ea33b..cb8615b6 100644 --- a/amitools/vamos/lib/lexec/Alloc.py +++ b/amitools/vamos/lib/lexec/Alloc.py @@ -191,6 +191,7 @@ def deallocate(ctx, mh_addr, blk_addr, num_bytes, check=False): # sanity check if blk_addr < mh.lower or (blk_addr + num_bytes - 1) > mh.upper: log_exec.error("deallocate: block outside of mem header!") + return if check: validate(ctx, mh) @@ -200,6 +201,7 @@ def deallocate(ctx, mh_addr, blk_addr, num_bytes, check=False): # sanity check if mh.free != 0: log_exec.error("deallocate: internal error: first=0 but free!=0!") + return # create new and only mem chunk in deallocated range mc = MemChunk(0, num_bytes, blk_addr) @@ -253,7 +255,7 @@ def deallocate(ctx, mh_addr, blk_addr, num_bytes, check=False): log_exec.debug("grow cur: %s", mc) # no merging possible -> create a new chunk between last and cur else: - next_addr = mc.addr if mc is not None else 0 + next_addr = mc.next if mc is not None else 0 mc_new = MemChunk(next_addr, num_bytes, blk_addr) mc_new.write(ctx) if mc_last: