Fix static analysis issues 58/204358/1
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 23 Apr 2019 09:12:30 +0000 (18:12 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 23 Apr 2019 09:12:30 +0000 (18:12 +0900)
- Initializes bundle pointers to nullptr
- Adds an exception handling

Change-Id: I9f49a1e236f62d0729db57b4e2a1b7e09cc3bd02
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/bundle_cpp_implementation.h
unit_tests/src/test_main.cc

index 5810f09..71bce84 100644 (file)
@@ -54,10 +54,10 @@ class Bundle::Impl {
  private:
   friend class Bundle;
 
-  bundle* handle_;
+  bundle* handle_ = nullptr;
   bool copy_ = true;
   bool own_ = true;
-  Bundle* parent_;
+  Bundle* parent_ = nullptr;
 };
 
 }  // namespace tizen_base
index df16333..22cae75 100644 (file)
 #include <gtest/gtest.h>
 #include <gmock/gmock.h>
 
+#include <exception>
+
 int main(int argc, char** argv) {
-  testing::InitGoogleTest(&argc, argv);
-  return RUN_ALL_TESTS();
+  try {
+    testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+  } catch (std::exception const &e) {
+    std::cout << "test_main caught exception: " << e.what() << std::endl;
+    return -1;
+  }
 }