diff options
author | Juan Manuel Tomás <jtomas1815@gmail.com> | 2020-04-24 15:35:29 -0300 |
---|---|---|
committer | Juan Manuel Tomás <jtomas1815@gmail.com> | 2020-04-24 15:35:29 -0300 |
commit | 7db6ffa2267a210cd7bbffa0c55f68656e396234 (patch) | |
tree | 8f9b42180b852e4046f7dad4bb661de39c4f6c28 /page.c | |
parent | a1a381926626aa44e264cd24dbf35e26f3d52330 (diff) | |
download | jet-7db6ffa2267a210cd7bbffa0c55f68656e396234.tar.gz jet-7db6ffa2267a210cd7bbffa0c55f68656e396234.zip |
Fix deleting first page corrupting page pointer
Diffstat (limited to 'page.c')
-rw-r--r-- | page.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -46,6 +46,13 @@ void split_page(struct page *back) { back->next = front; } +void copy_page(struct page *dest, struct page *src) { + memcpy(dest->elements, src->elements, PAGE_SIZE); + dest->gap_start = src->gap_start; + dest->gap_end = src->gap_end; + dest->element_count = src->element_count; +} + void free_page(struct page *page) { if (page->prev) { page->prev->next = page->next; @@ -53,6 +60,7 @@ void free_page(struct page *page) { if (page->next) { page->next->prev = page->prev; } + free(page->elements); free(page); } |