add NULL check in _mi_segment_of
This commit is contained in:
parent
89ba6cc2fa
commit
67439bb4e5
@ -285,8 +285,9 @@ void _mi_segment_map_freed_at(const mi_segment_t* segment) {
|
|||||||
|
|
||||||
// Determine the segment belonging to a pointer or NULL if it is not in a valid segment.
|
// Determine the segment belonging to a pointer or NULL if it is not in a valid segment.
|
||||||
static mi_segment_t* _mi_segment_of(const void* p) {
|
static mi_segment_t* _mi_segment_of(const void* p) {
|
||||||
|
if (p == NULL) return NULL;
|
||||||
mi_segment_t* segment = _mi_ptr_segment(p);
|
mi_segment_t* segment = _mi_ptr_segment(p);
|
||||||
if (segment == NULL) return NULL;
|
mi_assert_internal(segment != NULL);
|
||||||
size_t bitidx;
|
size_t bitidx;
|
||||||
size_t index = mi_segment_map_index_of(segment, &bitidx);
|
size_t index = mi_segment_map_index_of(segment, &bitidx);
|
||||||
// fast path: for any pointer to valid small/medium/large object or first MI_SEGMENT_SIZE in huge
|
// fast path: for any pointer to valid small/medium/large object or first MI_SEGMENT_SIZE in huge
|
||||||
|
Loading…
Reference in New Issue
Block a user