mirror of
git://git.musl-libc.org/musl
synced 2025-03-06 20:48:29 +01:00
fix malloc_usable_size for NULL input
the linux man page specifies malloc_usable_size(0) to return 0 and this is the semantics other implementations follow (jemalloc). reported by Alexander Monakov.
This commit is contained in:
parent
2810b30fc3
commit
d150764697
1 changed files with 1 additions and 1 deletions
|
@ -13,5 +13,5 @@ struct chunk {
|
|||
|
||||
size_t malloc_usable_size(void *p)
|
||||
{
|
||||
return CHUNK_SIZE(MEM_TO_CHUNK(p)) - OVERHEAD;
|
||||
return p ? CHUNK_SIZE(MEM_TO_CHUNK(p)) - OVERHEAD : 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue