Skip to content

Commit

Permalink
mem: fix attaching mmap to mmeory node
Browse files Browse the repository at this point in the history
  • Loading branch information
recp committed Aug 15, 2020
1 parent 4f4e809 commit f7beb91
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/mem/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,21 @@ ak_mmap_attach(void * __restrict obj, void * __restrict mapped, size_t sized) {
AkHeapNode *hnode;
AkMemoryMapNode **mmapNode, *mmapNodeNew;

heap = ak_heap_getheap(obj);
hnode = ak__alignof(obj);
mmapNode = (AkMemoryMapNode **)ak_heap_ext_add(heap, hnode, AK_HEAP_NODE_FLAGS_MMAP);
mmapNodeNew = ak_heap_calloc(heap, obj, sizeof(*mmapNodeNew));
heap = ak_heap_getheap(obj);
hnode = ak__alignof(obj);
mmapNode = (AkMemoryMapNode **)ak_heap_ext_add(heap, hnode, AK_HEAP_NODE_FLAGS_MMAP);

mmapNodeNew->mapped = mapped;
mmapNodeNew->sized = sized;

if (mmapNode && *mmapNode) {
mmapNodeNew->next = *mmapNode;
(*mmapNode)->prev = mmapNodeNew;
if (mmapNode) {
mmapNodeNew = ak_heap_calloc(heap, obj, sizeof(*mmapNodeNew));
mmapNodeNew->mapped = mapped;
mmapNodeNew->sized = sized;

if (*mmapNode) {
mmapNodeNew->next = *mmapNode;
(*mmapNode)->prev = mmapNodeNew;
}
*mmapNode = mmapNodeNew;
}

*mmapNode = mmapNodeNew;
}

AK_EXPORT
Expand Down

0 comments on commit f7beb91

Please sign in to comment.