mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-03-11 04:58:19 +03:00
resolve: first increment the reference counter
When `exist->rr` and `rr` point to the same object, then it may be freed by the `dns_resource_record_unref()`. (cherry picked from commit 4ce30e4de05971ea93bc727695000d0025eb1591)
This commit is contained in:
parent
013de49db5
commit
61e030e173
@ -169,8 +169,9 @@ int dns_answer_add(
|
||||
|
||||
/* Entry already exists, keep the entry with the higher TTL. */
|
||||
if (rr->ttl > exist->rr->ttl) {
|
||||
dns_resource_record_ref(rr);
|
||||
dns_resource_record_unref(exist->rr);
|
||||
exist->rr = dns_resource_record_ref(rr); /* lgtm [cpp/inconsistent-null-check] */
|
||||
exist->rr = rr;
|
||||
|
||||
/* Update RRSIG and RR at the same time */
|
||||
if (rrsig) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user