From: Marcin Siodelski Date: Tue, 13 Sep 2016 14:31:42 +0000 (+0200) Subject: [3161] Use smart pointer to supress clang static analyzer error. X-Git-Tag: trac5006_base~2^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0470cfd9575b3d878289edb8a1c93e528db7e3ce;p=thirdparty%2Fkea.git [3161] Use smart pointer to supress clang static analyzer error. The static analyzer indicated that the dereferenced object could be NULL but in fact it is not. However, it is still safer to use smart pointer, rather than raw pointer, so I updated the test. --- diff --git a/src/lib/dhcp/tests/option6_ia_unittest.cc b/src/lib/dhcp/tests/option6_ia_unittest.cc index ab1848c920..e2a7cc9823 100644 --- a/src/lib/dhcp/tests/option6_ia_unittest.cc +++ b/src/lib/dhcp/tests/option6_ia_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -291,8 +291,9 @@ TEST_F(Option6IATest, suboptionsUnpack) { ASSERT_NE(OptionPtr(), subopt); // non-NULL // Checks for address option - Option6IAAddr * addr = dynamic_cast(subopt.get()); - ASSERT_TRUE(NULL != addr); + Option6IAAddrPtr addr = + boost::dynamic_pointer_cast(subopt); + ASSERT_TRUE(addr); EXPECT_EQ(D6O_IAADDR, addr->getType()); EXPECT_EQ(28, addr->len());