fix mallocng regression in malloc_usable_size with null argument
authorDominic Chen <d.c.ddcc@gmail.com>
Wed, 25 Nov 2020 07:53:16 +0000 (02:53 -0500)
committerRich Felker <dalias@aerifal.cx>
Sun, 29 Nov 2020 06:07:05 +0000 (01:07 -0500)
commit d1507646975cbf6c3e511ba07b193f27f032d108 added support for null
argument in oldmalloc and was overlooked when switching to mallocng.

src/malloc/mallocng/malloc_usable_size.c

index a440a4e..ce6a960 100644 (file)
@@ -3,6 +3,7 @@
 
 size_t malloc_usable_size(void *p)
 {
+       if (!p) return 0;
        struct meta *g = get_meta(p);
        int idx = get_slot_index(p);
        size_t stride = get_stride(g);