aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndřej Bílka <neleai@seznam.cz>2013-10-25 19:16:08 +0200
committerOndřej Bílka <neleai@seznam.cz>2013-10-25 19:17:58 +0200
commit151659f6371ce39a488fd132a5c8ce5e3bba983c (patch)
treef3a90009fd76631bb2419cfe912580afe071694c
parent10b0f26b1950f8d38a5846b80833564df3c5b582 (diff)
downloadglibc-151659f6371ce39a488fd132a5c8ce5e3bba983c.zip
glibc-151659f6371ce39a488fd132a5c8ce5e3bba983c.tar.gz
glibc-151659f6371ce39a488fd132a5c8ce5e3bba983c.tar.bz2
Fix gethostbyname_r example. Fixes bug 2801.
-rw-r--r--ChangeLog5
-rw-r--r--NEWS16
-rw-r--r--manual/socket.texi8
3 files changed, 18 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 3e0e025..c2e5261 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2013-10-25 Ondřej Bílka <neleai@seznam.cz>
+ [BZ 2801]
+ * manual/socket.texi (Host Names): Fix gethostbyname_r example.
+
+2013-10-25 Ondřej Bílka <neleai@seznam.cz>
+
[BZ #14876]
* time/strptime_l.c (__strptime_internal): 14876 Read timezone entry.
* time/tst-strptime.c (day_tests): Add testcase.
diff --git a/NEWS b/NEWS
index 5055324..0b7e9f7 100644
--- a/NEWS
+++ b/NEWS
@@ -9,14 +9,14 @@ Version 2.19
* The following bugs are resolved with this release:
- 156, 431, 832, 10278, 13028, 13982, 13985, 14029, 14155, 14547, 14699,
- 14876, 14910, 15048, 15218, 15277, 15308, 15362, 15400, 15427, 15522,
- 15531, 15532, 15608, 15609, 15610, 15632, 15640, 15670, 15672, 15680,
- 15681, 15723, 15734, 15735, 15736, 15748, 15749, 15754, 15760, 15764,
- 15797, 15825, 15844, 15847, 15849, 15855, 15856, 15857, 15859, 15867,
- 15886, 15887, 15890, 15892, 15893, 15895, 15897, 15905, 15909, 15919,
- 15921, 15923, 15939, 15948, 15963, 15966, 15988, 16032, 16034, 16036,
- 16041, 16072, 16074.
+ 156, 431, 832, 2801, 10278, 13028, 13982, 13985, 14029, 14155, 14547,
+ 14699, 14876, 14910, 15048, 15218, 15277, 15308, 15362, 15400, 15427,
+ 15522, 15531, 15532, 15608, 15609, 15610, 15632, 15640, 15670, 15672,
+ 15680, 15681, 15723, 15734, 15735, 15736, 15748, 15749, 15754, 15760,
+ 15764, 15797, 15825, 15844, 15847, 15849, 15855, 15856, 15857, 15859,
+ 15867, 15886, 15887, 15890, 15892, 15893, 15895, 15897, 15905, 15909,
+ 15919, 15921, 15923, 15939, 15948, 15963, 15966, 15988, 16032, 16034,
+ 16036, 16041, 16072, 16074.
* CVE-2012-4412 The strcoll implementation caches indices and rules for
large collation sequences to optimize multiple passes. This cache
diff --git a/manual/socket.texi b/manual/socket.texi
index 25c35c4..4c7e623 100644
--- a/manual/socket.texi
+++ b/manual/socket.texi
@@ -1307,23 +1307,25 @@ Here's a small example:
struct hostent *
gethostname (char *host)
@{
- struct hostent hostbuf, *hp;
+ struct hostent *hostbuf, *hp;
size_t hstbuflen;
char *tmphstbuf;
int res;
int herr;
+ hostbuf = malloc (sizeof (struct hostent));
hstbuflen = 1024;
- /* Allocate buffer, remember to free it to avoid memory leakage. */
tmphstbuf = malloc (hstbuflen);
- while ((res = gethostbyname_r (host, &hostbuf, tmphstbuf, hstbuflen,
+ while ((res = gethostbyname_r (host, hostbuf, tmphstbuf, hstbuflen,
&hp, &herr)) == ERANGE)
@{
/* Enlarge the buffer. */
hstbuflen *= 2;
tmphstbuf = realloc (tmphstbuf, hstbuflen);
@}
+
+ free (tmphstbuf);
/* Check for errors. */
if (res || hp == NULL)
return NULL;