From 0f5860aad3a131d22b6fb1ffc97da83a1b1bca21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Fri, 27 Sep 2019 10:05:27 +0200 Subject: [PATCH] lib/dns/name.c: Fix dereference before DbC check reported by Cppcheck --- lib/dns/name.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/dns/name.c b/lib/dns/name.c index 2c021aad1f..e751194478 100644 --- a/lib/dns/name.c +++ b/lib/dns/name.c @@ -1345,7 +1345,7 @@ dns_name_totext2(const dns_name_t *name, unsigned int options, unsigned int trem, count; unsigned int labels; bool saw_root = false; - unsigned int oused = target->used; + unsigned int oused; dns_name_totextfilter_t *mem; dns_name_totextfilter_t totext_filter_proc = NULL; isc_result_t result; @@ -1358,6 +1358,8 @@ dns_name_totext2(const dns_name_t *name, unsigned int options, REQUIRE(VALID_NAME(name)); REQUIRE(ISC_BUFFER_VALID(target)); + oused = target->used; + result = totext_filter_proc_key_init(); if (result != ISC_R_SUCCESS) return (result);