public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/siddhesh/gai-cleanup2] gaih_inet: Put name copy under gaih_lookup cache
@ 2022-03-01 2:41 Siddhesh Poyarekar
0 siblings, 0 replies; only message in thread
From: Siddhesh Poyarekar @ 2022-03-01 2:41 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f66eb74240baa93a5a06eed517322d9a4a131ed4
commit f66eb74240baa93a5a06eed517322d9a4a131ed4
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date: Mon Feb 28 23:34:50 2022 +0530
gaih_inet: Put name copy under gaih_lookup cache
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diff:
---
sysdeps/posix/getaddrinfo.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 036a9539b0..f790921487 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -1218,7 +1218,6 @@ gaih_inet (const char *name, const struct gaih_service *service,
if ((rc = get_servtuples (service, req, st, tmpbuf)) != 0)
return rc;
- bool malloc_name = false;
int result = 0;
struct gaih_lookup_result res = {0};
struct scratch_buffer resbuf;
@@ -1226,6 +1225,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
if (name != NULL)
{
+ gaih_lookup_result_init (&res, &resbuf);
+
if (req->ai_flags & AI_IDN)
{
char *out;
@@ -1233,11 +1234,9 @@ gaih_inet (const char *name, const struct gaih_service *service,
if (result != 0)
return -result;
name = out;
- malloc_name = true;
+ gaih_lookup_result_push_alloc (&res, out);
}
- gaih_lookup_result_init (&res, &resbuf);
-
if ((result = get_numeric_res (name, req, &res)) != 0)
goto free_and_return;
else if (res.at != NULL)
@@ -1292,8 +1291,6 @@ process_list:
result = generate_addrinfo (canon, req, &res, st, pai, naddrs);
free_and_return:
- if (malloc_name)
- free ((char *) name);
if (result != 0)
free (canon);
gaih_lookup_result_free (&res);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-03-01 2:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01 2:41 [glibc/siddhesh/gai-cleanup2] gaih_inet: Put name copy under gaih_lookup cache Siddhesh Poyarekar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).