fix: remove from edge
This commit is contained in:
parent
aff161557e
commit
e65ab8192b
|
@ -5,26 +5,8 @@ int main(int argc, char const *argv[]) {
|
|||
sf_set_magic(0x0);
|
||||
|
||||
|
||||
size_t sz_u = 200, sz_v = 150, sz_w = 50, sz_x = 150, sz_y = 200, sz_z = 250;
|
||||
void *u = sf_malloc(sz_u);
|
||||
sf_malloc(4032);
|
||||
sf_show_heap();
|
||||
/* void *v = */ sf_malloc(sz_v);
|
||||
sf_show_heap();
|
||||
void *w = sf_malloc(sz_w);
|
||||
sf_show_heap();
|
||||
/* void *x = */ sf_malloc(sz_x);
|
||||
sf_show_heap();
|
||||
|
||||
void *y = sf_malloc(sz_y);
|
||||
sf_show_heap();
|
||||
/* void *z = */ sf_malloc(sz_z);
|
||||
sf_show_heap();
|
||||
|
||||
sf_free(u);
|
||||
sf_show_heap();
|
||||
sf_free(w);
|
||||
sf_show_heap();
|
||||
sf_free(y);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -100,6 +100,12 @@ void *sf_malloc(sf_size_t size)
|
|||
sf_block *last = get_prev_block(epi);
|
||||
if (get_alloc(last->header) == 1)
|
||||
last = epi;
|
||||
if (last->body.links.next != NULL)
|
||||
{
|
||||
last->body.links.next->body.links.prev = last->body.links.prev;
|
||||
last->body.links.prev->body.links.next = last->body.links.next;
|
||||
}
|
||||
|
||||
sf_size_t require_size = min_size - get_block_size(last->header);
|
||||
size_t i = 0;
|
||||
for (; i < require_size; i += 1024)
|
||||
|
|
Loading…
Reference in New Issue
Block a user