From be4021f8f4cf8e8ef415afd80402d99fd0bfd6de Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 1 May 2022 14:11:11 +0900 Subject: [PATCH] [qfcc] Actually shrink the unaligned hole This fixes the duplicate allocation caused by an exact fit aligned alloc in an unaligned hole where the padding remains free. --- tools/qfcc/source/defspace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/qfcc/source/defspace.c b/tools/qfcc/source/defspace.c index a704b45a3..e1dc3b72a 100644 --- a/tools/qfcc/source/defspace.c +++ b/tools/qfcc/source/defspace.c @@ -173,7 +173,8 @@ defspace_alloc_aligned_loc (defspace_t *space, int size, int alignment) // exact fit, so just shrink the block or remove it if there is no // padding (any padding remains free) if (size + pad == loc->size) { - if (!pad) { + loc->size -= size; + if (!loc->size) { *l = loc->next; del_locref (loc); }