From 7c6003d17f7ee636f26b2f002f1b5fc6e6ef0471 Mon Sep 17 00:00:00 2001 From: Jan Kadlec <jan.kadlec@nic.cz> Date: Mon, 14 Apr 2014 09:58:40 +0200 Subject: [PATCH] coverity: fixed Coverity errors in the new node a co. --- src/common/hattrie/hat-trie.c | 7 ------- src/knot/updates/ddns.c | 11 +++++++++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/common/hattrie/hat-trie.c b/src/common/hattrie/hat-trie.c index 0993635026..0c6b46ddb2 100644 --- a/src/common/hattrie/hat-trie.c +++ b/src/common/hattrie/hat-trie.c @@ -230,10 +230,6 @@ static inline node_ptr hattrie_find(node_ptr *parent, const char **key, size_t * return hattrie_find_ns(&parent, &sp, 0, key, len); } -static inline value_t hattrie_setval(value_t v) { - return v; -} - /* initialize root node */ static void hattrie_initroot(hattrie_t *T) { @@ -321,9 +317,6 @@ hattrie_t* hattrie_dup(const hattrie_t* T, value_t (*nval)(value_t)) return N; } - /* assignment */ - if (!nval) nval = hattrie_setval; - /*! \todo could be probably implemented faster */ size_t l = 0; diff --git a/src/knot/updates/ddns.c b/src/knot/updates/ddns.c index b3ffdd7173..04a46f6338 100644 --- a/src/knot/updates/ddns.c +++ b/src/knot/updates/ddns.c @@ -373,7 +373,10 @@ static bool node_empty(const knot_node_t *node, knot_dname_t *owner, knot_rrset_init(&node_rr, node->owner, node_rrset.type, KNOT_CLASS_IN); for (uint16_t j = 0; j < node_rrset.rrs.rr_count; ++j) { knot_rdata_t *add_rr = knot_rdataset_at(&node_rrset.rrs, j); - knot_rdataset_add(&node_rr.rrs, add_rr, NULL); + int ret = knot_rdataset_add(&node_rr.rrs, add_rr, NULL); + if (ret != KNOT_EOK) { + return false; + } if (!removed_rr(changeset, &node_rr)) { // One of the RRs from node was not removed. knot_rdataset_clear(&node_rr.rrs, NULL); @@ -708,8 +711,12 @@ static int process_rem_rr(const knot_rrset_t *rr, rr->type == KNOT_RRTYPE_NS; if (apex_ns) { const knot_rdataset_t *ns_rrs = knot_node_rdataset(node, KNOT_RRTYPE_NS); + if (ns_rrs == NULL) { + // Zone without apex NS. + return KNOT_EOK; + } if (*apex_ns_rem == ns_rrs->rr_count - 1) { - // Cannot remove last apex NS RR + // Cannot remove last apex NS RR. return KNOT_EOK; } } -- GitLab