Hi All, What should be the expected return value of realloc(3) in case you ask it to allocate 0 bytes ? As per the standard <http://pubs.opengroup.org/onlinepubs/009696899/functions/realloc.html> it should either return NULL or a pointer which can be passed to free(). By running some tests, it appears that on NetBSD it is the latter case. Is this correct? If this is the case, then I think it should be clearly documented in the man page. FWIW on GNU/Linux, it appears that the default bevahiour is to return NULL in case the requested size is 0 bytes (and it is documented). The attached patch should do the needful (I hope) :-) (While there, also fix a typo in malloc.c). Regards Abhinav
Attachment:
malloc.3.diff
Description: Binary data
Attachment:
malloc.c.diff
Description: Binary data