aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-04-27 22:19:05 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-04-27 22:19:05 +0200
commitf3a7f87cc18352110a7b95d64bb4dba0d119ad37 (patch)
tree80e8683fde9a3278d45d4a764e2ce910ce31a2f5 /lib
parent6f99a07cfa20a8af30b77f101e3195add723cc03 (diff)
Explicitly save errno on failure in mkregion()
Diffstat (limited to 'lib')
-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;