This commit is contained in:
robertblaketaylor 2023-04-04 09:40:43 -07:00 committed by GitHub
commit fa1b20a05b
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

@ -399,7 +399,15 @@ static bool mi_is_valid_pointer(const void* p) {
}
mi_decl_nodiscard mi_decl_export bool mi_is_in_heap_region(const void* p) mi_attr_noexcept {
return mi_is_valid_pointer(p);
if mi_likely(mi_is_valid_pointer(p)) {
return true;
}
// when unable to allocate aligned OS memory directly, pointer cookie is same as segment cookie
mi_segment_t* const segment = _mi_ptr_segment(p);
if (segment == NULL) return false;
return (_mi_ptr_cookie(segment) == segment->cookie);
}
/*