mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Tweak get_new_frec() behaviour in "force" mode.
get_new_frec() is not supposed to ever free an frec when the force arg is set. Make this so. In theory, this fixes a bug, but it's practically impossible to provoke and I have no evidence that it has ever happened IRL.
This commit is contained in:
@@ -3128,8 +3128,9 @@ static struct frec *get_new_frec(time_t now, struct server *master, int force)
|
|||||||
/* Don't free DNSSEC sub-queries here, as we may end up with
|
/* Don't free DNSSEC sub-queries here, as we may end up with
|
||||||
dangling references to them. They'll go when their "real" query
|
dangling references to them. They'll go when their "real" query
|
||||||
is freed. */
|
is freed. */
|
||||||
if (!f->dependent && !force)
|
if (!f->dependent)
|
||||||
#endif
|
#endif
|
||||||
|
if (!force)
|
||||||
{
|
{
|
||||||
if (difftime(now, f->time) >= 4*TIMEOUT)
|
if (difftime(now, f->time) >= 4*TIMEOUT)
|
||||||
{
|
{
|
||||||
@@ -3146,7 +3147,9 @@ static struct frec *get_new_frec(time_t now, struct server *master, int force)
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!force && count >= daemon->ftabsize)
|
if (!force)
|
||||||
|
{
|
||||||
|
if (count >= daemon->ftabsize)
|
||||||
{
|
{
|
||||||
query_full(now, master->domain);
|
query_full(now, master->domain);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -3159,6 +3162,7 @@ static struct frec *get_new_frec(time_t now, struct server *master, int force)
|
|||||||
free_frec(oldest);
|
free_frec(oldest);
|
||||||
target = oldest;
|
target = oldest;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!target && (target = (struct frec *)whine_malloc(sizeof(struct frec))))
|
if (!target && (target = (struct frec *)whine_malloc(sizeof(struct frec))))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user