https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104069
--- Comment #19 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Note, actually because of the glibc and AIX behavior, after the first realloc returns NULL if size is 0, then ptr has been freed and so the code actually is a use after free. For BSD it is not a use after free.