aboutsummaryrefslogtreecommitdiff
path: root/sys/libn
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2020-04-22 20:00:41 -0700
committerNicholas Noll <nbnoll@eml.cc>2020-04-22 20:00:41 -0700
commit1a6c99600617f069d6d167fb3d33142a07fe0936 (patch)
treeea41789b66c0bb220b9f3703ddb7a3c9482ddbc9 /sys/libn
parent7f1b6ff70b97e424ce73314809838c7cd94f3ae7 (diff)
fix: double free problem
Diffstat (limited to 'sys/libn')
-rw-r--r--sys/libn/memory.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/libn/memory.c b/sys/libn/memory.c
index 6b715d9..ca0c819 100644
--- a/sys/libn/memory.c
+++ b/sys/libn/memory.c
@@ -102,7 +102,7 @@ grow(mem·Arena *a, vlong min)
Assert(a->off == ALIGN_DOWN_PTR(a->off, ARENA_ALIGN));
a->curr->next = blk;
- a->curr = blk;
+ a->curr = blk;
}
void*
@@ -128,11 +128,11 @@ mem·freearena(mem·Arena *a)
{
struct Block *it, *next;
- it = &a->first;
+ it = a->first.next;
while (it != nil) {
next = it->next;
a->heap.free(it);
- it = next;
+ it = next;
}
a->heap.free(a);