From 7210f994fb3991e624e9afc417db177c9cb1c7dc Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Thu, 3 Dec 2020 10:25:24 +0300 Subject: [PATCH] mdbx-windows: fix `mdbx_realloc()` for nullptr and `MDBX_AVOID_CRT=ON`. Change-Id: I129221186d65254da5b1d84747e5c59d53864b70 --- src/osal.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/osal.h b/src/osal.h index a1c8c1f6..be02cf11 100644 --- a/src/osal.h +++ b/src/osal.h @@ -181,7 +181,8 @@ static inline void *mdbx_calloc(size_t nelem, size_t size) { #ifndef mdbx_realloc static inline void *mdbx_realloc(void *ptr, size_t bytes) { - return LocalReAlloc(ptr, bytes, LMEM_MOVEABLE); + return ptr ? LocalReAlloc(ptr, bytes, LMEM_MOVEABLE) + : LocalAlloc(LMEM_FIXED, bytes); } #endif /* mdbx_realloc */