fix: Pointer arithmetic error during block start calculation.

This commit is contained in:
2025-06-30 19:45:06 +02:00
parent 84ba41e180
commit f3ca4cdd72
2 changed files with 5 additions and 2 deletions

View File

@@ -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 *set_ll_free_one(struct SETBlockMeta *head, void *address)
{ {
struct SETBlockMeta *meta = struct SETBlockMeta *meta =
(struct SETBlockMeta *)address - (sizeof(struct SETBlockMeta)); (struct SETBlockMeta *)(address - (sizeof(struct SETBlockMeta)));
printf("Freeing: %p\n", meta);
if (meta->prev == NULL) if (meta->prev == NULL)
{ {

View File

@@ -64,6 +64,8 @@ void *set_malloc(size_t n)
block_meta_head->end = meta; block_meta_head->end = meta;
} }
printf("Allocating at address %p\n", blocks);
return blocks + sizeof(struct SETBlockMeta); return blocks + sizeof(struct SETBlockMeta);
} }