summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2015-12-01 07:16:05 +0000
committerngie <ngie@FreeBSD.org>2015-12-01 07:16:05 +0000
commit194e32cbb7f3822a9951dce328c2033e9808f264 (patch)
treef07829a21ed059cdb98fb6e94c31333b38c1c554 /lib/libc
parentf72e7ffb5712fdd5cb7a3e9462df25b7f9863c53 (diff)
downloadFreeBSD-src-194e32cbb7f3822a9951dce328c2033e9808f264.zip
FreeBSD-src-194e32cbb7f3822a9951dce328c2033e9808f264.tar.gz
MFC r269326:
r269326 (by n_hibma): Fix the example: free the memory that was allocated by getline().
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/stdio/getline.31
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/libc/stdio/getline.3 b/lib/libc/stdio/getline.3
index 2161999..05f07d0 100644
--- a/lib/libc/stdio/getline.3
+++ b/lib/libc/stdio/getline.3
@@ -95,6 +95,7 @@ size_t linecap = 0;
ssize_t linelen;
while ((linelen = getline(&line, &linecap, fp)) > 0)
fwrite(line, linelen, 1, stdout);
+free(line);
.Ed
.Sh COMPATIBILITY
Many application writers used the name
OpenPOWER on IntegriCloud