]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3161] Use smart pointer to supress clang static analyzer error.
authorMarcin Siodelski <marcin@isc.org>
Tue, 13 Sep 2016 14:31:42 +0000 (16:31 +0200)
committerMarcin Siodelski <marcin@isc.org>
Tue, 13 Sep 2016 14:31:42 +0000 (16:31 +0200)
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.

src/lib/dhcp/tests/option6_ia_unittest.cc

index ab1848c92014ec0b3e59e971b2e6885877be067f..e2a7cc9823a26afcad4daff64bfd9e53b02ef5ad 100644 (file)
@@ -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<Option6IAAddr*>(subopt.get());
-    ASSERT_TRUE(NULL != addr);
+    Option6IAAddrPtr addr =
+        boost::dynamic_pointer_cast<Option6IAAddr>(subopt);
+    ASSERT_TRUE(addr);
 
     EXPECT_EQ(D6O_IAADDR, addr->getType());
     EXPECT_EQ(28, addr->len());