about summary refs log tree commit diff
path: root/malloc/malloc-debug.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2021-07-22 18:38:16 +0530
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2021-07-22 18:38:16 +0530
commit6856975ed4ce79355752d08938f066f2ed9fcfb5 (patch)
tree0ef325b468fc9dcc399a854b17433fb7969fa79d /malloc/malloc-debug.c
parent1e5a5866cb9541b5231dba3d86c8a1a35d516de9 (diff)
downloadglibc-6856975ed4ce79355752d08938f066f2ed9fcfb5.tar.gz
glibc-6856975ed4ce79355752d08938f066f2ed9fcfb5.tar.xz
glibc-6856975ed4ce79355752d08938f066f2ed9fcfb5.zip
mcheck Fix malloc_usable_size [BZ #22057]
Interpose malloc_usable_size to return the correct mcheck value for
malloc_usable_size.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'malloc/malloc-debug.c')
-rw-r--r--malloc/malloc-debug.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/malloc/malloc-debug.c b/malloc/malloc-debug.c
index 34523b0cc3..9922ef5f25 100644
--- a/malloc/malloc-debug.c
+++ b/malloc/malloc-debug.c
@@ -399,6 +399,8 @@ strong_alias (__debug_calloc, calloc)
 size_t
 malloc_usable_size (void *mem)
 {
+  if (__is_malloc_debug_enabled (MALLOC_MCHECK_HOOK))
+    return mcheck_usable_size (mem);
   if (__is_malloc_debug_enabled (MALLOC_CHECK_HOOK))
     return malloc_check_get_size (mem);