diff options
author | deraadt <> | 2017-03-17 17:00:38 +0000 |
---|---|---|
committer | deraadt <> | 2017-03-17 17:00:38 +0000 |
commit | 6ee5556003da806b1ae4bd259575fd70982e30ba (patch) | |
tree | 4c7ed62ec184581a7c650059f45d72b7e7eb1460 /src/lib/libc | |
parent | 854a4a0e4ddf686eb6d9e36d8b0af8926c723a28 (diff) | |
download | openbsd-6ee5556003da806b1ae4bd259575fd70982e30ba.tar.gz openbsd-6ee5556003da806b1ae4bd259575fd70982e30ba.tar.bz2 openbsd-6ee5556003da806b1ae4bd259575fd70982e30ba.zip |
Strengthen description of recallocarray(3) behaviour, hoping that readers
make the behaviour -> use case connection.
help from jmc and jsing
Diffstat (limited to 'src/lib/libc')
-rw-r--r-- | src/lib/libc/stdlib/malloc.3 | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/lib/libc/stdlib/malloc.3 b/src/lib/libc/stdlib/malloc.3 index e24a811bec..0053748991 100644 --- a/src/lib/libc/stdlib/malloc.3 +++ b/src/lib/libc/stdlib/malloc.3 | |||
@@ -30,9 +30,9 @@ | |||
30 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 30 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
31 | .\" SUCH DAMAGE. | 31 | .\" SUCH DAMAGE. |
32 | .\" | 32 | .\" |
33 | .\" $OpenBSD: malloc.3,v 1.103 2017/03/07 06:07:50 otto Exp $ | 33 | .\" $OpenBSD: malloc.3,v 1.104 2017/03/17 17:00:38 deraadt Exp $ |
34 | .\" | 34 | .\" |
35 | .Dd $Mdocdate: March 7 2017 $ | 35 | .Dd $Mdocdate: March 17 2017 $ |
36 | .Dt MALLOC 3 | 36 | .Dt MALLOC 3 |
37 | .Os | 37 | .Os |
38 | .Sh NAME | 38 | .Sh NAME |
@@ -119,9 +119,14 @@ The | |||
119 | .Fn recallocarray | 119 | .Fn recallocarray |
120 | function is similar to | 120 | function is similar to |
121 | .Fn reallocarray | 121 | .Fn reallocarray |
122 | except that it takes care of clearing newly allocated memory. | 122 | except it ensures newly allocated memory is cleared similar to |
123 | Additionally, the memory that becomes unallocated while shrinking | 123 | .Xr calloc 3 . |
124 | or moving existing allocations is erased. | 124 | Memory that becomes unallocated while shrinking or moving existing |
125 | allocations is explicitly discarded (meaning, pages of memory | ||
126 | are disposed via | ||
127 | .Xr munmap 2 , | ||
128 | and smaller allocations are cleared with | ||
129 | .Xr explicit_bzero 3 Ns ). | ||
125 | If | 130 | If |
126 | .Fa ptr | 131 | .Fa ptr |
127 | is a | 132 | is a |