From f3a7f87cc18352110a7b95d64bb4dba0d119ad37 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sat, 27 Apr 2024 22:19:05 +0200 Subject: Explicitly save errno on failure in mkregion() --- lib/alloc/arena_alloc.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/alloc') 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; -- cgit v1.2.3