summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1999-11-12 16:41:21 +0000
committerpeter <peter@FreeBSD.org>1999-11-12 16:41:21 +0000
commit70fc0d318e7b73855ad6367ae9820262a1947403 (patch)
treef2713aba3343533baa67265810fe3cd6464e5508 /lib/libc
parent1b5e9c01a918d993ce544ac3100ae7bdb5561f54 (diff)
downloadFreeBSD-src-70fc0d318e7b73855ad6367ae9820262a1947403.zip
FreeBSD-src-70fc0d318e7b73855ad6367ae9820262a1947403.tar.gz
Go to a bit more trouble to make it absolutely clear that malloc(3)
does not zero the allocated memory.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/stdlib/malloc.311
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/libc/stdlib/malloc.3 b/lib/libc/stdlib/malloc.3
index de93382..764bad1 100644
--- a/lib/libc/stdlib/malloc.3
+++ b/lib/libc/stdlib/malloc.3
@@ -73,6 +73,12 @@ If
.Fn malloc
fails, a NULL pointer is returned.
.Pp
+Note that
+.Fn malloc
+does
+.Em NOT
+normally initialize the returned memory to zero bytes.
+.Pp
The
.Fn calloc
function allocates space for
@@ -85,7 +91,8 @@ The result is identical to calling
.Fn malloc
with an argument of
.Dq "number * size" ,
-with the exception that the allocated memory is initialized to nul bytes.
+with the exception that the allocated memory is explicitly initialized
+to zero bytes.
.Pp
The
.Fn realloc
@@ -310,7 +317,7 @@ options and symbols for debugger support.
If the program starts to give unusual results, coredump or generally behave
differently without emitting any of the messages listed in the next
section, it is likely because it depends on the storage being filled with
-nul bytes. Try running it with
+zero bytes. Try running it with
.Dq Z
option set;
if that improves the situation, this diagnosis has been confirmed.
OpenPOWER on IntegriCloud