Skip to content
Snippets Groups Projects
Commit 429d31bd authored by Jan Kadlec's avatar Jan Kadlec
Browse files

zone-events: Fixed leaks and possible NULL access in DDNS.

parent a8ae27a8
Branches
Tags
No related merge requests found
......@@ -118,6 +118,11 @@ static bool apex_rr_changed(const zone_contents_t *old_contents,
{
knot_rrset_t old_rr = node_rrset(old_contents->apex, type);
knot_rrset_t new_rr = node_rrset(new_contents->apex, type);
if (knot_rrset_empty(&old_rr)) {
return !knot_rrset_empty(&new_rr);
} else if (knot_rrset_empty(&new_rr)) {
return !knot_rrset_empty(&old_rr);
}
return !knot_rrset_equal(&old_rr, &new_rr, KNOT_RRSET_COMPARE_WHOLE);
}
......
......@@ -220,8 +220,7 @@ int knot_changeset_apply(knot_changeset_t *changeset,
int knot_changeset_merge(knot_changeset_t *ch1, knot_changeset_t *ch2)
{
if (ch1 == NULL || ch2 == NULL || ch1->data != NULL ||
ch2->data != NULL) {
if (ch1 == NULL || ch2 == NULL || ch1->data != NULL || ch2->data != NULL) {
return KNOT_EINVAL;
}
......@@ -232,6 +231,7 @@ int knot_changeset_merge(knot_changeset_t *ch1, knot_changeset_t *ch2)
// Use soa_to and serial from the second changeset
// soa_to from the first changeset is redundant, delete it
knot_rrset_free(&ch1->soa_to, NULL);
knot_rrset_free(&ch2->soa_from, NULL);
ch1->soa_to = ch2->soa_to;
ch1->serial_to = ch2->serial_to;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment