I know of two implementations that do this (ASan is not protecting against accessing the returned memory for now, just like malloc(0)):
SIE libc on the PS4
dlmalloc has a flag for this
This allows us to properly support this behaviour.
Differential D31295
Add free_on_realloc_zero=true flag for compatibility with allocators which allow a realloc(p, 0) and don't free the pointer. filcab on Mar 23 2017, 10:51 AM. Authored by
Details I know of two implementations that do this (ASan is not protecting against accessing the returned memory for now, just like malloc(0)): This allows us to properly support this behaviour.
Diff Detail
Event TimelineComment Actions Ah, so is it also allowed to access P[0] under ASan after doing P = malloc(0)? If so, I can't spot any issues here. Comment Actions I am horrified by the amount of flags we already have, and would like to reduce it, not increase it. Comment Actions
Yes, please!
It's not too much of a problem, and I *am* interested to have reasonable patches upstream. Comment Actions Ok, let's do it. But I'd like to choose a better flag name.
Comment Actions Address review comments
|