From b3c5295256b43dd753255e0dc0f876d613c19323 Mon Sep 17 00:00:00 2001 From: Sheldon Hearn Date: Wed, 22 Dec 1999 17:04:46 +0000 Subject: Document the current behaviour with respect to the handling of errno. Approved by: phk --- lib/libc/stdlib/malloc.3 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/libc/stdlib') diff --git a/lib/libc/stdlib/malloc.3 b/lib/libc/stdlib/malloc.3 index 764bad1033de..f4e75e2f748f 100644 --- a/lib/libc/stdlib/malloc.3 +++ b/lib/libc/stdlib/malloc.3 @@ -264,7 +264,10 @@ The and .Fn calloc functions return a pointer to the allocated memory if successful; otherwise -a NULL pointer is returned. +a NULL pointer is returned and +.Va errno +is set to +.Er ENOMEM . .Pp The .Fn realloc @@ -277,6 +280,10 @@ if successful; otherwise a NULL pointer is returned, in which case the memory referenced by .Fa ptr is still available and intact. +In the case of memory allocation failure, +.Va errno +is set to +.Er ENOMEM . .Pp The .Fn free -- cgit v1.3