From 400e8aae5fb36105aea9f22457526dbda5cdf925 Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Wed, 22 Nov 2023 15:21:06 -0500 Subject: resolves memory instability preventing pointer reuse --- src/memory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/memory.cpp b/src/memory.cpp index fb6c591..c5d8375 100644 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -116,11 +116,11 @@ void *Pke_New(std::size_t sz, std::size_t alignment, MemBucket *bkt) { nextBlock->size += afterSize; } long moveCount = bkt->lastEmptyBlockIndex - index; + bkt->lastEmptyBlockIndex -= 1; if (moveCount > 0) { char *srcPos = bkt->blocks + (sizeof(MemBlock) * (index + 1)); char *dstPos = bkt->blocks + (sizeof(MemBlock) * (index + 0)); memmove(dstPos, srcPos, sizeof(MemBlock) * moveCount); - bkt->lastEmptyBlockIndex -= 1; } } } -- cgit v1.2.3