aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/alloc/arena_alloc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/alloc/arena_alloc.c b/lib/alloc/arena_alloc.c
index eceb5b9..814b0bb 100644
--- a/lib/alloc/arena_alloc.c
+++ b/lib/alloc/arena_alloc.c
@@ -31,7 +31,9 @@ mkregion(size_t cap)
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0),
};
if (r->data == MAP_FAILED) {
+ int save = errno;
free(r);
+ errno = save;
return nullptr;
}
return r;