From 516a39595e4967679292302079d89722cfb6dafb Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Wed, 25 Jan 2017 09:49:08 +1300 Subject: [PATCH] random_r.3: Note that 'buf' records a pointer to 'statebuf' See https://sourceware.org/bugzilla/show_bug.cgi?id=3662. Signed-off-by: Michael Kerrisk --- man3/random_r.3 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/man3/random_r.3 b/man3/random_r.3 index 68470b6b9..394260939 100644 --- a/man3/random_r.3 +++ b/man3/random_r.3 @@ -97,6 +97,23 @@ rather than initializing the global state variable. Before calling this function, the .IR buf.state field must be initialized to NULL. +The +.BR initstate_r () +function records a pointer to the +.I statebuf +argument inside the structure pointed to by +.IR buf . +Thus, +.IR statebuf +should not be deallocated so long as +.IR buf +is still in use. +(So, +.I statebuf +should typically be allocated as a static variable, +or allocated on the heap using +.BR malloc (3) +or similar.) The .BR setstate_r ()