From 1984cb3b3d749f2d99aae05602d5534dd33f8e88 Mon Sep 17 00:00:00 2001 From: Thibaut Sautereau Date: Wed, 10 Feb 2021 09:55:09 +0100 Subject: [PATCH] malloc_object_size: avoid fault for invalid region It's the region pointer that can be NULL here, and p was checked at the beginning of the function. --- h_malloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/h_malloc.c b/h_malloc.c index c661b8b..52a227d 100644 --- a/h_malloc.c +++ b/h_malloc.c @@ -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();