Skip to content

Commit

Permalink
malloc_object_size: avoid fault for invalid region
Browse files Browse the repository at this point in the history
It's the region pointer that can be NULL here, and p was checked at the
beginning of the function.
  • Loading branch information
tsautereau-anssi authored and thestinger committed Feb 10, 2021
1 parent 76860c7 commit 1984cb3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion h_malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1690,7 +1690,7 @@ EXPORT size_t h_malloc_object_size(void *p) {
struct region_allocator *ra = ro.region_allocator;
mutex_lock(&ra->lock);
struct region_metadata *region = regions_find(p);
size_t size = p == NULL ? SIZE_MAX : region->size;
size_t size = region == NULL ? SIZE_MAX : region->size;
mutex_unlock(&ra->lock);

thread_seal_metadata();
Expand Down

0 comments on commit 1984cb3

Please sign in to comment.