Browse Source

Clarify and mention that errno is set to ENOMEM on failure of malloc(),

calloc(), and realloc().  Idea from NetBSD.
OPENBSD_2_7
pjanzen 25 years ago
parent
commit
9bbca5e9e2
1 changed files with 11 additions and 5 deletions
  1. +11
    -5
      src/lib/libc/stdlib/malloc.3

+ 11
- 5
src/lib/libc/stdlib/malloc.3 View File

@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.\" $OpenBSD: malloc.3,v 1.17 1999/11/10 22:19:22 aaron Exp $
.\" $OpenBSD: malloc.3,v 1.18 2000/01/19 05:36:38 pjanzen Exp $
.\" .\"
.Dd August 27, 1996 .Dd August 27, 1996
.Dt MALLOC 3 .Dt MALLOC 3
@ -241,8 +241,11 @@ The
and and
.Fn calloc .Fn calloc
functions return functions return
a pointer to the allocated space if successful; otherwise
a null pointer is returned.
a pointer to the allocated space if successful; otherwise,
a null pointer is returned and
.Va errno
is set to
.Er ENOMEM .
.Pp .Pp
The The
.Fn free .Fn free
@ -252,8 +255,11 @@ functions return no value.
.Pp .Pp
The The
.Fn realloc .Fn realloc
function a pointer to the possibly moved allocated space;
otherwise a null pointer is returned.
function returns a pointer to the (possibly moved) allocated space
if successful; otherwise, a null pointer is returned and
.Va errno
is set to
.Er ENOMEM .
.Sh MESSAGES .Sh MESSAGES
If If
.Fn malloc , .Fn malloc ,


Loading…
Cancel
Save