fix segfault error in mi_os_mem_free

if was_commited has value "false" then we can't access to memory at "addr"
This commit is contained in:
hardened-steel 2019-12-05 12:10:16 +03:00 committed by GitHub
parent 80dc7a3eb0
commit 8243f623aa
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23

View file

@ -219,6 +219,7 @@ static bool mi_os_mem_free(void* addr, size_t size, bool was_committed, mi_stats
{
if (addr == NULL || size == 0 || _mi_os_is_huge_reserved(addr)) return true;
bool err = false;
if(was_committed)
_mi_call_user_cleanup(addr, size);
#if defined(_WIN32)
err = (VirtualFree(addr, 0, MEM_RELEASE) == 0);