summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2023-11-22 15:21:06 -0500
committerJonathan Bradley <jcb@pikum.xyz>2023-11-22 15:21:06 -0500
commit400e8aae5fb36105aea9f22457526dbda5cdf925 (patch)
tree7372207104b88789beb8a248716895dc16925990 /src
parent3084f81a209723a5dbf1712a5d31fb30ba87bd7f (diff)
resolves memory instability preventing pointer reuse
Diffstat (limited to 'src')
-rw-r--r--src/memory.cpp2
1 files changed, 1 insertions, 1 deletions
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;
}
}
}