diff --git a/src/resolvers.c b/src/resolvers.c index fe705c48d..0a424cf7c 100644 --- a/src/resolvers.c +++ b/src/resolvers.c @@ -1943,7 +1943,7 @@ static struct resolv_resolution *resolv_pick_resolution(struct resolvers *resolv struct resolv_resolution *res = NULL; if (!*hostname_dn) - goto err; + goto from_pool; /* Search for same hostname and query type in resolutions.curr */ list_for_each_entry(res, &resolvers->resolutions.curr, list) { @@ -1981,9 +1981,11 @@ static struct resolv_resolution *resolv_pick_resolution(struct resolvers *resolv res->prefered_query_type = query_type; res->query_type = query_type; - res->hostname_dn = strdup(*hostname_dn); - if (res->hostname_dn == NULL) - goto err; + if (*hostname_dn) { + res->hostname_dn = strdup(*hostname_dn); + if (res->hostname_dn == NULL) + goto err; + } res->hostname_dn_len = hostname_dn_len; ++resolution_uuid;