From: Andrei Pavel Date: Wed, 28 Jun 2023 19:15:23 +0000 (+0300) Subject: [#2831] move null check closer to place of effect X-Git-Tag: Kea-2.4.0~37 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d40f634efcb634443c4e7cbba2cfe1ec05834577;p=thirdparty%2Fkea.git [#2831] move null check closer to place of effect --- diff --git a/src/lib/dns/nsec3hash.cc b/src/lib/dns/nsec3hash.cc index 279a2bd562..c5fbd81f58 100644 --- a/src/lib/dns/nsec3hash.cc +++ b/src/lib/dns/nsec3hash.cc @@ -68,11 +68,10 @@ public: static_cast(algorithm_)); } - if (salt_data == NULL) { - isc_throw(isc::BadValue, "salt data is NULL"); - } - if (salt_length > 0) { + if (salt_data == NULL) { + isc_throw(isc::BadValue, "salt data is NULL"); + } salt_data_ = static_cast(std::malloc(salt_length)); if (salt_data_ == NULL) { throw std::bad_alloc();