Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport fixes to gvm_hosts_resolve(). #228

Merged
merged 2 commits into from
May 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions base/hosts.c
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,7 @@ gvm_hosts_reverse (gvm_hosts_t *hosts)
void
gvm_hosts_resolve (gvm_hosts_t *hosts)
{
size_t i, new_entries = 0;
size_t i, new_entries = 0 , resolved = 0;

for (i = 0; i < hosts->count; i++)
{
Expand Down Expand Up @@ -1372,16 +1372,17 @@ gvm_hosts_resolve (gvm_hosts_t *hosts)
}
/* Remove hostname from list, as it was either replaced by IPs, or
* is unresolvable. */
gvm_host_free (host);
hosts->hosts[i] = NULL;
hosts->count--;
hosts->removed++;
resolved++;
if (!list)
g_warning ("Couldn't resolve hostname %s", host->name);
else
gvm_hosts_fill_gaps (hosts);
gvm_host_free (host);
g_slist_free_full (list, g_free);
}
if (resolved)
gvm_hosts_fill_gaps (hosts);
hosts->count -= resolved;
hosts->removed += resolved;
if (new_entries)
gvm_hosts_deduplicate (hosts);
hosts->current = 0;
Expand Down