From f3ca4cdd72aac30003aeff50c8a9d3c9d1aac794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorben=20H=C3=B6hne?= Date: Mon, 30 Jun 2025 19:45:06 +0200 Subject: [PATCH] fix: Pointer arithmetic error during block start calculation. --- src/list.c | 5 +++-- src/utils.c | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/list.c b/src/list.c index c17c700..bb83506 100644 --- a/src/list.c +++ b/src/list.c @@ -24,9 +24,10 @@ void set_ll_free_all(struct SETBlockMeta *head) struct SETBlockMeta *set_ll_free_one(struct SETBlockMeta *head, void *address) { - struct SETBlockMeta *meta = - (struct SETBlockMeta *)address - (sizeof(struct SETBlockMeta)); + (struct SETBlockMeta *)(address - (sizeof(struct SETBlockMeta))); + + printf("Freeing: %p\n", meta); if (meta->prev == NULL) { diff --git a/src/utils.c b/src/utils.c index 4f88b84..391eb62 100644 --- a/src/utils.c +++ b/src/utils.c @@ -64,6 +64,8 @@ void *set_malloc(size_t n) block_meta_head->end = meta; } + printf("Allocating at address %p\n", blocks); + return blocks + sizeof(struct SETBlockMeta); }