summaryrefslogtreecommitdiff
path: root/manual/stdio.texi
diff options
context:
space:
mode:
authorDavid Svoboda <svoboda@cert.org>2014-04-02 05:13:02 -0400
committerMike Frysinger <vapier@gentoo.org>2014-04-03 18:23:57 -0400
commit1c21d115e3e47cd66007341de4bae5c4b0a2d547 (patch)
treea5fa2bf5c51461c06b2438ae16580aa3bd324bc4 /manual/stdio.texi
parentfcccd51286acbf9c19ac57ab7143e257d58323fd (diff)
manual: clarify buffer behavior in getline [BZ #5666]
If the user has requested automatic buffer creation, getline may create it and not free things when an error occurs. That means the user is always responsible for calling free() regardless of the return value. The current documentation does not explicitly cover this which leaves it slightly ambiguous to the reader. So clarify things. URL: https://sourceware.org/bugzilla/show_bug.cgi?id=5666
Diffstat (limited to 'manual/stdio.texi')
-rw-r--r--manual/stdio.texi3
1 files changed, 2 insertions, 1 deletions
diff --git a/manual/stdio.texi b/manual/stdio.texi
index a4364f79f9..efdaaadf27 100644
--- a/manual/stdio.texi
+++ b/manual/stdio.texi
@@ -1298,7 +1298,8 @@ back in @code{*@var{n}}.
If you set @code{*@var{lineptr}} to a null pointer, and @code{*@var{n}}
to zero, before the call, then @code{getline} allocates the initial
-buffer for you by calling @code{malloc}.
+buffer for you by calling @code{malloc}. This buffer remains allocated
+even if @code{getline} encounters errors and is unable to read any bytes.
In either case, when @code{getline} returns, @code{*@var{lineptr}} is
a @code{char *} which points to the text of the line.