From 4acf8befe0deab4fc34e662cb4f3b72ca4f61a65 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 19 Dec 2022 12:12:05 +0100 Subject: [PATCH] Mention that mlock() failing is not a hard error for sodium_malloc() --- src/libsodium/sodium/utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsodium/sodium/utils.c b/src/libsodium/sodium/utils.c index 98c9f5a6..0fe77007 100644 --- a/src/libsodium/sodium/utils.c +++ b/src/libsodium/sodium/utils.c @@ -616,7 +616,7 @@ _sodium_malloc(const size_t size) memcpy(unprotected_ptr + unprotected_size, canary, sizeof canary); # endif _mprotect_noaccess(unprotected_ptr + unprotected_size, page_size); - sodium_mlock(unprotected_ptr, unprotected_size); + (void) sodium_mlock(unprotected_ptr, unprotected_size); /* not a hard error in the context of sodium_malloc() */ canary_ptr = unprotected_ptr + _page_round(size_with_canary) - size_with_canary; user_ptr = canary_ptr + sizeof canary; @@ -686,7 +686,7 @@ sodium_free(void *ptr) _out_of_bounds(); } # endif - sodium_munlock(unprotected_ptr, unprotected_size); + (void) sodium_munlock(unprotected_ptr, unprotected_size); _free_aligned(base_ptr, total_size); } #endif /* HAVE_ALIGNED_MALLOC */