dns: Fix memory use-after-free.

* dirmngr/dns.c (dns_res_stub): Fix RESCONF usage.

--

Note that this is dead code.  It is for making a static analyzer happy.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2020-08-19 15:16:34 +09:00
parent f58d441bee
commit cc0d53905c
1 changed files with 6 additions and 0 deletions

View File

@ -8301,8 +8301,14 @@ struct dns_resolver *dns_res_stub(const struct dns_options *opts, int *error) {
if (!(hints = dns_hints_local(resconf, error)))
goto epilog;
/* RESCONF is closed by dns_hints_local, so, get it again. */
if (!(resconf = dns_resconf_local(error)))
goto epilog;
if (!(res = dns_res_open(resconf, hosts, hints, NULL, opts, error)))
goto epilog;
else
return res;
epilog:
dns_resconf_close(resconf);