NetBSD Problem Report #47384
From www@NetBSD.org Sun Dec 30 18:04:39 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
by www.NetBSD.org (Postfix) with ESMTP id 68ED863E33E
for <gnats-bugs@gnats.NetBSD.org>; Sun, 30 Dec 2012 18:04:39 +0000 (UTC)
Message-Id: <20121230180438.6316D63E33E@www.NetBSD.org>
Date: Sun, 30 Dec 2012 18:04:38 +0000 (UTC)
From: er.abhinav.upadhyay@gmail.com
Reply-To: er.abhinav.upadhyay@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Document return value of realloc(3) when the size parameter is zero
X-Send-Pr-Version: www-1.0
>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: pgoyette
>State: closed
>Class: doc-bug
>Submitter-Id: net
>Arrival-Date: Sun Dec 30 18:05:00 +0000 2012
>Closed-Date: Wed Jun 01 05:45:39 +0000 2016
>Last-Modified: Wed Jun 01 05:45:39 +0000 2016
>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:/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
>Release-Note:
>Audit-Trail:
From: "Paul Goyette" <pgoyette@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/47384 CVS commit: src/lib/libc/stdlib
Date: Wed, 1 Jun 2016 05:40:27 +0000
Module Name: src
Committed By: pgoyette
Date: Wed Jun 1 05:40:27 UTC 2016
Modified Files:
src/lib/libc/stdlib: malloc.3
Log Message:
Document return value for realloc(3) when size is 0. From PR lib/47384
To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/lib/libc/stdlib/malloc.3
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Responsible-Changed-From-To: lib-bug-people->pgoyette
Responsible-Changed-By: pgoyette@NetBSD.org
Responsible-Changed-When: Wed, 01 Jun 2016 05:45:39 +0000
Responsible-Changed-Why:
I handled it.
State-Changed-From-To: open->closed
State-Changed-By: pgoyette@NetBSD.org
State-Changed-When: Wed, 01 Jun 2016 05:45:39 +0000
State-Changed-Why:
Suggested doc update was committed.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.