summaryrefslogtreecommitdiff
path: root/upb/upb.c
diff options
context:
space:
mode:
Diffstat (limited to 'upb/upb.c')
-rw-r--r--upb/upb.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/upb/upb.c b/upb/upb.c
index d8d2723..9f80639 100644
--- a/upb/upb.c
+++ b/upb/upb.c
@@ -191,10 +191,8 @@ upb_arena *upb_arena_init(void *mem, size_t n, upb_alloc *alloc) {
}
}
- a = mem;
- mem = (char*)mem + sizeof(*a);
+ a = (void*)((char*)mem + n - sizeof(*a));
n -= sizeof(*a);
- upb_arena_addblock(a, mem, n, owned);
a->alloc.func = &upb_arena_doalloc;
a->block_alloc = &upb_alloc_global;
@@ -205,6 +203,8 @@ upb_arena *upb_arena_init(void *mem, size_t n, upb_alloc *alloc) {
a->block_head = NULL;
a->block_alloc = alloc;
+ upb_arena_addblock(a, mem, n, owned);
+
return a;
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback