NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/47384: Document return value of realloc(3) when the size parameter is zero



>Number:         47384
>Category:       lib
>Synopsis:       Document return value of realloc(3) when the size parameter is 
>zero
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 30 18:05:00 +0000 2012
>Originator:     Abhinav Upadhyay
>Release:        NetBSD-current
>Organization:
>Environment:
NetBSD  6.99.15 NetBSD 6.99.15 (GENERIC) #0: Fri Nov 30 23:27:05 UTC 2012  
builds%b6.netbsd.org@localhost:/home/builds/ab/HEAD/i386/201211301540Z-obj/home/builds/ab/HEAD/src/sys/arch/i386/compile/GENERIC
 i386
>Description:
As discussed on tech-userlevel, the man page for realloc(3) should document the 
expected return value when the size parameter is zero, as per the standards 
(http://pubs.opengroup.org/onlinepubs/009696899/functions/realloc.html)
>How-To-Repeat:

>Fix:
Index: malloc.3
===================================================================
RCS file: /cvsroot/src/lib/libc/stdlib/malloc.3,v
retrieving revision 1.38
diff -u -r1.38 malloc.3
--- malloc.3    3 May 2010 08:23:20 -0000       1.38
+++ malloc.3    30 Dec 2012 17:58:33 -0000
@@ -143,6 +143,11 @@
 .Fn realloc
 function always leaves the original buffer intact
 when an error occurs.
+If
+.Ar size
+is 0, either NULL or a pointer that can be safely passed to
+.Xr free 3
+is returned.
 .Pp
 The
 .Fn free



Home | Main Index | Thread Index | Old Index