From: Tristan Bauer <67098820+trisbauer@users.noreply.github.com> Date: Thu, 18 Jun 2020 09:45:24 +0000 (+0200) Subject: Fix wrong return value check of mmap function X-Git-Tag: openssl-3.0.0-alpha4~45 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1d78129dd205e3e85083a91c33540a70c51b0a23;p=oweals%2Fopenssl.git Fix wrong return value check of mmap function The mmap function never returns NULL. If an error occurs, the function returns MAP_FAILED. CLA: trivial Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/12187) --- diff --git a/crypto/mem_sec.c b/crypto/mem_sec.c index e28a43e295..ddc0a370e6 100644 --- a/crypto/mem_sec.c +++ b/crypto/mem_sec.c @@ -514,7 +514,7 @@ static void sh_done(void) OPENSSL_free(sh.freelist); OPENSSL_free(sh.bittable); OPENSSL_free(sh.bitmalloc); - if (sh.map_result != NULL && sh.map_size) + if (sh.map_result != MAP_FAILED && sh.map_size) munmap(sh.map_result, sh.map_size); memset(&sh, 0, sizeof(sh)); }