fix: Pointer arithmetic error during block start calculation.
This commit is contained in:
@@ -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)
|
||||||
{
|
{
|
||||||
|
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user