]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
lib/dns/name.c: Fix dereference before DbC check reported by Cppcheck
authorOndřej Surý <ondrej@sury.org>
Fri, 27 Sep 2019 08:05:27 +0000 (10:05 +0200)
committerOndřej Surý <ondrej@sury.org>
Thu, 3 Oct 2019 07:50:26 +0000 (09:50 +0200)
(cherry picked from commit 0f5860aad3a131d22b6fb1ffc97da83a1b1bca21)

lib/dns/name.c

index 89c719a91f6b4e06000e9c4a2f107cccabd3899b..7ff29e366507ea303bdd2c6d8bd5934682b99a2f 100644 (file)
@@ -1348,7 +1348,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;
@@ -1361,6 +1361,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);