https://bugs.kde.org/show_bug.cgi?id=436413
--- Comment #8 from Paul Floyd <pjfl...@wanadoo.fr> --- I've done as much testing as I can (with a slight exception for musl where I just looked at the source). Universally, if ptr is 0 then the call behaves like malloc. My initial feeling is that we shouldn't warn in that case. Where things diverge is when the size is 0 (which is what this is all about). Linux glibc calls free and returns NULL. Even here that is not necessarily the case as there is a macro REALLOC_ZERO_BYTES_FREES that controls it (by default it is activated). Illumos also frees and returns NULL (with no macro). All other platforms call free and allocate "something". I don't have a 100% clear picture of the size of that something. On FreeBSD (which uses jemalloc) the size is bumped up to 1. Musl leaves it at 0. I don't have access to the Solaris source, but 11.3 doesn't return NULL at least. Need to double check that. I'd like this behaviour to try to be as much like the underlying system as possible. So I'll add a second option --realloc-zero-bytes-frees=[yes|no]. The default will depend on the platform. When yes the behaviour will be like glibc, when no the behaviour will be like jemalloc. I don't see any practical way to determine this at runtime. That should allow someone who is using musl libc with a glibc built Valgrind to switch. -- You are receiving this mail because: You are watching all bug changes.