public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Siddhesh Poyarekar <siddhesh@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc/siddhesh/gai-cleanup2] gaih_inet: Put name copy under gaih_lookup cache Date: Tue, 1 Mar 2022 02:41:37 +0000 (GMT) [thread overview] Message-ID: <20220301024137.B0FE43858409@sourceware.org> (raw) 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);
reply other threads:[~2022-03-01 2:41 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220301024137.B0FE43858409@sourceware.org \ --to=siddhesh@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).