diff options
author | daan <daanl@outlook.com> | 2019-07-23 15:54:47 -0700 |
---|---|---|
committer | daan <daanl@outlook.com> | 2019-07-23 15:54:47 -0700 |
commit | 3d6feead60daf63decdba9c5a0ae4a7dee0f037b (patch) | |
tree | 73d095517038cb3a0f226b9cd882d6aa86c04527 /src/alloc-posix.c | |
parent | dd79b662f8af0be546ac907ea322e7c8650f5f25 (diff) |
add heap region check to cfree
Diffstat (limited to 'src/alloc-posix.c')
-rw-r--r-- | src/alloc-posix.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/alloc-posix.c b/src/alloc-posix.c index 1f55b3a..672b73b 100644 --- a/src/alloc-posix.c +++ b/src/alloc-posix.c @@ -38,7 +38,9 @@ size_t mi_malloc_usable_size(const void *p) mi_attr_noexcept { } void mi_cfree(void* p) mi_attr_noexcept { - mi_free(p); + if (mi_is_in_heap_region(p)) { + mi_free(p); + } } int mi_posix_memalign(void** p, size_t alignment, size_t size) mi_attr_noexcept { |