summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorn_hibma <n_hibma@FreeBSD.org>2014-07-31 08:28:42 +0000
committern_hibma <n_hibma@FreeBSD.org>2014-07-31 08:28:42 +0000
commit9c75b0e638ba182a996fb4c76aa8d76cfc13b2ee (patch)
tree6a37cce69b7317796e678dcf6296d829581c9d51 /lib/libc
parentd088b795005f841dac5202d879e858e68a590b71 (diff)
downloadFreeBSD-src-9c75b0e638ba182a996fb4c76aa8d76cfc13b2ee.zip
FreeBSD-src-9c75b0e638ba182a996fb4c76aa8d76cfc13b2ee.tar.gz
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