From: Marek VavruĊĦa Date: Wed, 18 Apr 2018 22:43:06 +0000 (-0700) Subject: zonecut: fix kr_zonecut_find_nsname with the trie implementation X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f68a99f08683ff4ed3e225e37594d69159fd319f;p=thirdparty%2Fknot-resolver.git zonecut: fix kr_zonecut_find_nsname with the trie implementation --- diff --git a/lib/zonecut.c b/lib/zonecut.c index e642e0b89..49fa805ed 100644 --- a/lib/zonecut.c +++ b/lib/zonecut.c @@ -119,7 +119,7 @@ int kr_zonecut_copy(struct kr_zonecut *dst, const struct kr_zonecut *src) } /* Copy the contents, one by one. */ int ret = kr_ok(); - trie_it_t *it; + trie_it_t *it = NULL; for (it = trie_it_begin(src->nsset); !trie_it_finished(it); trie_it_next(it)) { size_t klen; const char * const k = trie_it_key(it, &klen); @@ -473,12 +473,14 @@ const knot_dname_t *kr_zonecut_find_nsname(struct kr_zonecut *cut) return NULL; } + trie_it_t *it = NULL; const knot_dname_t *result = NULL; - trie_it_t *it; for (it = trie_it_begin(cut->nsset); !trie_it_finished(it); trie_it_next(it)) { - result = (const knot_dname_t *)trie_it_key(it, NULL); + size_t klen; + result = (const knot_dname_t *) trie_it_key(it, &klen); break; } trie_it_free(it); + return result; } \ No newline at end of file