diff options
author | Florian Weimer <fweimer@redhat.com> | 2020-01-20 18:37:13 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2020-01-20 18:37:13 +0100 |
commit | 8b222fa38700422b4da6731806835f0bbf40920d (patch) | |
tree | bb0c933e2a35c97558970771e473095f7c2cd953 /sysdeps/posix | |
parent | 92ce43eef7ac844782d50a8015d977d216fbadec (diff) | |
download | glibc-8b222fa38700422b4da6731806835f0bbf40920d.tar.gz glibc-8b222fa38700422b4da6731806835f0bbf40920d.tar.xz glibc-8b222fa38700422b4da6731806835f0bbf40920d.zip |
getaddrinfo: Fix resource leak after strdup failure in gethosts [BZ #25425]
Filip Ochnik spotted that one of the error jumps in gethosts fails to call __resolv_context_put to release the resolver context. Fixes commit 352f4ff9a268b81ef5d4b2413f582565806e4790 ("resolv: Introduce struct resolv_context [BZ #21668]") and commit 964263bb8d650f1681665c55704fb01a8e725621 ("getaddrinfo: Release resolver context on error in gethosts [BZ #21885]"). Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'sysdeps/posix')
-rw-r--r-- | sysdeps/posix/getaddrinfo.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index f813d85aa3..538691a598 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -288,6 +288,7 @@ convert_hostent_to_gaih_addrtuple (const struct addrinfo *req, canonbuf = __strdup (localcanon); \ if (canonbuf == NULL) \ { \ + __resolv_context_put (res_ctx); \ result = -EAI_SYSTEM; \ goto free_and_return; \ } \ |